noumen 0.1.0 → 0.2.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 (118) hide show
  1. package/README.md +767 -51
  2. package/dist/a2a/index.d.ts +148 -0
  3. package/dist/a2a/index.js +579 -0
  4. package/dist/a2a/index.js.map +1 -0
  5. package/dist/acp/index.d.ts +129 -0
  6. package/dist/acp/index.js +498 -0
  7. package/dist/acp/index.js.map +1 -0
  8. package/dist/agent-BrkbZyOT.d.ts +1028 -0
  9. package/dist/cache-DVqaCX8v.d.ts +38 -0
  10. package/dist/chunk-2ZTGQLYK.js +356 -0
  11. package/dist/chunk-2ZTGQLYK.js.map +1 -0
  12. package/dist/chunk-42PHHZUA.js +132 -0
  13. package/dist/chunk-42PHHZUA.js.map +1 -0
  14. package/dist/chunk-4SQA2UCV.js +26 -0
  15. package/dist/chunk-4SQA2UCV.js.map +1 -0
  16. package/dist/chunk-5GEX6ZSB.js +179 -0
  17. package/dist/chunk-5GEX6ZSB.js.map +1 -0
  18. package/dist/chunk-7ZMN7XJE.js +94 -0
  19. package/dist/chunk-7ZMN7XJE.js.map +1 -0
  20. package/dist/chunk-AMYIJSAZ.js +57 -0
  21. package/dist/chunk-AMYIJSAZ.js.map +1 -0
  22. package/dist/chunk-BGG2E6JD.js +10 -0
  23. package/dist/chunk-BGG2E6JD.js.map +1 -0
  24. package/dist/chunk-BZSFUEWM.js +43 -0
  25. package/dist/chunk-BZSFUEWM.js.map +1 -0
  26. package/dist/chunk-CPFHEPW4.js +139 -0
  27. package/dist/chunk-CPFHEPW4.js.map +1 -0
  28. package/dist/chunk-D43BWEZA.js +346 -0
  29. package/dist/chunk-D43BWEZA.js.map +1 -0
  30. package/dist/chunk-DGUM43GV.js +11 -0
  31. package/dist/chunk-DGUM43GV.js.map +1 -0
  32. package/dist/chunk-JACGEMTF.js +43 -0
  33. package/dist/chunk-JACGEMTF.js.map +1 -0
  34. package/dist/chunk-JX7CLUCV.js +21 -0
  35. package/dist/chunk-JX7CLUCV.js.map +1 -0
  36. package/dist/chunk-KXDB56YW.js +39 -0
  37. package/dist/chunk-KXDB56YW.js.map +1 -0
  38. package/dist/chunk-KY6ZPWHO.js +112 -0
  39. package/dist/chunk-KY6ZPWHO.js.map +1 -0
  40. package/dist/chunk-NBDFQYUZ.js +7992 -0
  41. package/dist/chunk-NBDFQYUZ.js.map +1 -0
  42. package/dist/chunk-OGXNFXFA.js +196 -0
  43. package/dist/chunk-OGXNFXFA.js.map +1 -0
  44. package/dist/chunk-QTJ7VTJY.js +1994 -0
  45. package/dist/chunk-QTJ7VTJY.js.map +1 -0
  46. package/dist/chunk-UVSSQBDY.js +192 -0
  47. package/dist/chunk-UVSSQBDY.js.map +1 -0
  48. package/dist/chunk-Y45R3PQL.js +684 -0
  49. package/dist/chunk-Y45R3PQL.js.map +1 -0
  50. package/dist/cli/index.d.ts +1 -0
  51. package/dist/cli/index.js +868 -0
  52. package/dist/cli/index.js.map +1 -0
  53. package/dist/client/index.d.ts +64 -0
  54. package/dist/client/index.js +409 -0
  55. package/dist/client/index.js.map +1 -0
  56. package/dist/client-CRRO2376.js +10 -0
  57. package/dist/client-CRRO2376.js.map +1 -0
  58. package/dist/headless-Q7XHHZIW.js +143 -0
  59. package/dist/headless-Q7XHHZIW.js.map +1 -0
  60. package/dist/history-snip-64GYP4ZL.js +12 -0
  61. package/dist/history-snip-64GYP4ZL.js.map +1 -0
  62. package/dist/index.d.ts +1305 -418
  63. package/dist/index.js +384 -1757
  64. package/dist/index.js.map +1 -1
  65. package/dist/jsonrpc/index.d.ts +54 -0
  66. package/dist/jsonrpc/index.js +34 -0
  67. package/dist/jsonrpc/index.js.map +1 -0
  68. package/dist/lsp/index.d.ts +36 -0
  69. package/dist/lsp/index.js +16 -0
  70. package/dist/lsp/index.js.map +1 -0
  71. package/dist/lsp-PS3BWIHC.js +8 -0
  72. package/dist/lsp-PS3BWIHC.js.map +1 -0
  73. package/dist/manager-DLXK63XC.js +8 -0
  74. package/dist/manager-DLXK63XC.js.map +1 -0
  75. package/dist/mcp/index.d.ts +111 -0
  76. package/dist/mcp/index.js +104 -0
  77. package/dist/mcp/index.js.map +1 -0
  78. package/dist/mcp-auth-AEI2R4ZC.js +9 -0
  79. package/dist/mcp-auth-AEI2R4ZC.js.map +1 -0
  80. package/dist/ollama-YNXAYP3R.js +18 -0
  81. package/dist/ollama-YNXAYP3R.js.map +1 -0
  82. package/dist/provider-factory-34MSWJZ3.js +20 -0
  83. package/dist/provider-factory-34MSWJZ3.js.map +1 -0
  84. package/dist/providers/anthropic.d.ts +19 -0
  85. package/dist/providers/anthropic.js +33 -0
  86. package/dist/providers/anthropic.js.map +1 -0
  87. package/dist/providers/bedrock.d.ts +39 -0
  88. package/dist/providers/bedrock.js +54 -0
  89. package/dist/providers/bedrock.js.map +1 -0
  90. package/dist/providers/gemini.d.ts +16 -0
  91. package/dist/providers/gemini.js +224 -0
  92. package/dist/providers/gemini.js.map +1 -0
  93. package/dist/providers/openai.d.ts +18 -0
  94. package/dist/providers/openai.js +8 -0
  95. package/dist/providers/openai.js.map +1 -0
  96. package/dist/providers/openrouter.d.ts +16 -0
  97. package/dist/providers/openrouter.js +23 -0
  98. package/dist/providers/openrouter.js.map +1 -0
  99. package/dist/providers/vertex.d.ts +40 -0
  100. package/dist/providers/vertex.js +64 -0
  101. package/dist/providers/vertex.js.map +1 -0
  102. package/dist/render-GRN4ZSSW.js +14 -0
  103. package/dist/render-GRN4ZSSW.js.map +1 -0
  104. package/dist/resolve-XM52G7YE.js +14 -0
  105. package/dist/resolve-XM52G7YE.js.map +1 -0
  106. package/dist/server/index.d.ts +128 -0
  107. package/dist/server/index.js +626 -0
  108. package/dist/server/index.js.map +1 -0
  109. package/dist/server-Cg1yWGaV.d.ts +96 -0
  110. package/dist/spinner-OJNR6NFO.js +8 -0
  111. package/dist/spinner-OJNR6NFO.js.map +1 -0
  112. package/dist/types-2kTLUCnD.d.ts +107 -0
  113. package/dist/types-3c88cRKH.d.ts +547 -0
  114. package/dist/types-CwKKucOF.d.ts +620 -0
  115. package/dist/types-DwdzmXfs.d.ts +107 -0
  116. package/dist/types-NIyVwQ4h.d.ts +109 -0
  117. package/dist/types-QwfylltH.d.ts +71 -0
  118. package/package.json +134 -6
@@ -0,0 +1,23 @@
1
+ import {
2
+ OpenAIProvider
3
+ } from "../chunk-CPFHEPW4.js";
4
+ import "../chunk-DGUM43GV.js";
5
+
6
+ // src/providers/openrouter.ts
7
+ var OpenRouterProvider = class extends OpenAIProvider {
8
+ constructor(opts) {
9
+ super({
10
+ apiKey: opts.apiKey,
11
+ baseURL: "https://openrouter.ai/api/v1",
12
+ model: opts.model ?? "anthropic/claude-opus-4.6",
13
+ defaultHeaders: {
14
+ ...opts.appName ? { "X-Title": opts.appName } : {},
15
+ ...opts.appUrl ? { "HTTP-Referer": opts.appUrl } : {}
16
+ }
17
+ });
18
+ }
19
+ };
20
+ export {
21
+ OpenRouterProvider
22
+ };
23
+ //# sourceMappingURL=openrouter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/providers/openrouter.ts"],"sourcesContent":["import { OpenAIProvider } from \"./openai.js\";\n\nexport interface OpenRouterProviderOptions {\n apiKey: string;\n model?: string;\n /** Displayed on openrouter.ai rankings. Sent as the `X-Title` header. */\n appName?: string;\n /** Used for openrouter.ai rankings. Sent as the `HTTP-Referer` header. */\n appUrl?: string;\n}\n\nexport class OpenRouterProvider extends OpenAIProvider {\n constructor(opts: OpenRouterProviderOptions) {\n super({\n apiKey: opts.apiKey,\n baseURL: \"https://openrouter.ai/api/v1\",\n model: opts.model ?? \"anthropic/claude-opus-4.6\",\n defaultHeaders: {\n ...(opts.appName ? { \"X-Title\": opts.appName } : {}),\n ...(opts.appUrl ? { \"HTTP-Referer\": opts.appUrl } : {}),\n },\n });\n }\n}\n"],"mappings":";;;;;;AAWO,IAAM,qBAAN,cAAiC,eAAe;AAAA,EACrD,YAAY,MAAiC;AAC3C,UAAM;AAAA,MACJ,QAAQ,KAAK;AAAA,MACb,SAAS;AAAA,MACT,OAAO,KAAK,SAAS;AAAA,MACrB,gBAAgB;AAAA,QACd,GAAI,KAAK,UAAU,EAAE,WAAW,KAAK,QAAQ,IAAI,CAAC;AAAA,QAClD,GAAI,KAAK,SAAS,EAAE,gBAAgB,KAAK,OAAO,IAAI,CAAC;AAAA,MACvD;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -0,0 +1,40 @@
1
+ import { A as AIProvider, C as ChatParams, a as ChatStreamChunk } from '../types-3c88cRKH.js';
2
+ import { C as CacheControlConfig } from '../cache-DVqaCX8v.js';
3
+
4
+ interface VertexAnthropicProviderOptions {
5
+ /** GCP project ID. If omitted, inferred from application default credentials. */
6
+ projectId?: string;
7
+ /** GCP region (default: us-east5). */
8
+ region?: string;
9
+ /**
10
+ * A `GoogleAuth` instance or any object with a compatible `getClient()` method.
11
+ * If omitted, the provider creates one using application default credentials.
12
+ * Requires `google-auth-library` as a peer dependency.
13
+ */
14
+ googleAuth?: unknown;
15
+ /** Model ID in Vertex format (default: claude-opus-4.6). */
16
+ model?: string;
17
+ /** Cache control config (same as AnthropicProvider). */
18
+ cacheControl?: CacheControlConfig;
19
+ /**
20
+ * Pre-constructed AnthropicVertex client. When provided, all other
21
+ * connection options are ignored. Useful for testing or advanced setups.
22
+ */
23
+ client?: unknown;
24
+ }
25
+ /**
26
+ * Anthropic provider routed through Google Cloud Vertex AI.
27
+ *
28
+ * Requires `@anthropic-ai/vertex-sdk` as an optional peer dependency.
29
+ * If `googleAuth` is not provided, also requires `google-auth-library`.
30
+ * Install with: `pnpm add @anthropic-ai/vertex-sdk google-auth-library`
31
+ */
32
+ declare class VertexAnthropicProvider implements AIProvider {
33
+ private client;
34
+ private defaultModel;
35
+ private cacheConfig;
36
+ constructor(opts: VertexAnthropicProviderOptions);
37
+ chat(params: ChatParams): AsyncIterable<ChatStreamChunk>;
38
+ }
39
+
40
+ export { VertexAnthropicProvider, type VertexAnthropicProviderOptions };
@@ -0,0 +1,64 @@
1
+ import {
2
+ streamAnthropicChat
3
+ } from "../chunk-2ZTGQLYK.js";
4
+ import "../chunk-KY6ZPWHO.js";
5
+ import {
6
+ __require
7
+ } from "../chunk-DGUM43GV.js";
8
+
9
+ // src/providers/vertex.ts
10
+ var VertexAnthropicProvider = class {
11
+ client;
12
+ defaultModel;
13
+ cacheConfig;
14
+ constructor(opts) {
15
+ if (opts.client) {
16
+ this.client = opts.client;
17
+ } else {
18
+ let AnthropicVertex;
19
+ try {
20
+ AnthropicVertex = __require("@anthropic-ai/vertex-sdk").AnthropicVertex;
21
+ } catch {
22
+ throw new Error(
23
+ "VertexAnthropicProvider requires @anthropic-ai/vertex-sdk. Install it with: pnpm add @anthropic-ai/vertex-sdk"
24
+ );
25
+ }
26
+ let googleAuth = opts.googleAuth;
27
+ if (!googleAuth) {
28
+ let GoogleAuth;
29
+ try {
30
+ GoogleAuth = __require("google-auth-library").GoogleAuth;
31
+ } catch {
32
+ throw new Error(
33
+ "VertexAnthropicProvider requires google-auth-library when googleAuth is not provided. Install it with: pnpm add google-auth-library"
34
+ );
35
+ }
36
+ const authArgs = {
37
+ scopes: ["https://www.googleapis.com/auth/cloud-platform"]
38
+ };
39
+ if (opts.projectId) authArgs.projectId = opts.projectId;
40
+ googleAuth = new GoogleAuth(authArgs);
41
+ }
42
+ const args = {
43
+ region: opts.region ?? "us-east5",
44
+ googleAuth
45
+ };
46
+ if (opts.projectId) args.projectId = opts.projectId;
47
+ this.client = new AnthropicVertex(args);
48
+ }
49
+ this.defaultModel = opts.model ?? "claude-opus-4.6";
50
+ this.cacheConfig = opts.cacheControl;
51
+ }
52
+ async *chat(params) {
53
+ yield* streamAnthropicChat(
54
+ this.client,
55
+ params,
56
+ this.defaultModel,
57
+ this.cacheConfig
58
+ );
59
+ }
60
+ };
61
+ export {
62
+ VertexAnthropicProvider
63
+ };
64
+ //# sourceMappingURL=vertex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/providers/vertex.ts"],"sourcesContent":["import type {\n AIProvider,\n ChatParams,\n ChatStreamChunk,\n} from \"./types.js\";\nimport type { CacheControlConfig } from \"./cache.js\";\nimport { streamAnthropicChat, type AnthropicStreamClient } from \"./anthropic-shared.js\";\n\nexport interface VertexAnthropicProviderOptions {\n /** GCP project ID. If omitted, inferred from application default credentials. */\n projectId?: string;\n /** GCP region (default: us-east5). */\n region?: string;\n /**\n * A `GoogleAuth` instance or any object with a compatible `getClient()` method.\n * If omitted, the provider creates one using application default credentials.\n * Requires `google-auth-library` as a peer dependency.\n */\n googleAuth?: unknown;\n /** Model ID in Vertex format (default: claude-opus-4.6). */\n model?: string;\n /** Cache control config (same as AnthropicProvider). */\n cacheControl?: CacheControlConfig;\n /**\n * Pre-constructed AnthropicVertex client. When provided, all other\n * connection options are ignored. Useful for testing or advanced setups.\n */\n client?: unknown;\n}\n\n/**\n * Anthropic provider routed through Google Cloud Vertex AI.\n *\n * Requires `@anthropic-ai/vertex-sdk` as an optional peer dependency.\n * If `googleAuth` is not provided, also requires `google-auth-library`.\n * Install with: `pnpm add @anthropic-ai/vertex-sdk google-auth-library`\n */\nexport class VertexAnthropicProvider implements AIProvider {\n private client: AnthropicStreamClient;\n private defaultModel: string;\n private cacheConfig: CacheControlConfig | undefined;\n\n constructor(opts: VertexAnthropicProviderOptions) {\n if (opts.client) {\n this.client = opts.client as AnthropicStreamClient;\n } else {\n let AnthropicVertex: new (args: Record<string, unknown>) => unknown;\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n AnthropicVertex = require(\"@anthropic-ai/vertex-sdk\").AnthropicVertex;\n } catch {\n throw new Error(\n \"VertexAnthropicProvider requires @anthropic-ai/vertex-sdk. \" +\n \"Install it with: pnpm add @anthropic-ai/vertex-sdk\",\n );\n }\n\n let googleAuth = opts.googleAuth;\n if (!googleAuth) {\n let GoogleAuth: new (args: Record<string, unknown>) => unknown;\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n GoogleAuth = require(\"google-auth-library\").GoogleAuth;\n } catch {\n throw new Error(\n \"VertexAnthropicProvider requires google-auth-library when googleAuth is not provided. \" +\n \"Install it with: pnpm add google-auth-library\",\n );\n }\n const authArgs: Record<string, unknown> = {\n scopes: [\"https://www.googleapis.com/auth/cloud-platform\"],\n };\n if (opts.projectId) authArgs.projectId = opts.projectId;\n googleAuth = new GoogleAuth(authArgs);\n }\n\n const args: Record<string, unknown> = {\n region: opts.region ?? \"us-east5\",\n googleAuth,\n };\n if (opts.projectId) args.projectId = opts.projectId;\n\n this.client = new AnthropicVertex(args) as unknown as AnthropicStreamClient;\n }\n\n this.defaultModel = opts.model ?? \"claude-opus-4.6\";\n this.cacheConfig = opts.cacheControl;\n }\n\n async *chat(params: ChatParams): AsyncIterable<ChatStreamChunk> {\n yield* streamAnthropicChat(\n this.client,\n params,\n this.defaultModel,\n this.cacheConfig,\n );\n }\n}\n"],"mappings":";;;;;;;;;AAqCO,IAAM,0BAAN,MAAoD;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EAER,YAAY,MAAsC;AAChD,QAAI,KAAK,QAAQ;AACf,WAAK,SAAS,KAAK;AAAA,IACrB,OAAO;AACL,UAAI;AACJ,UAAI;AAEF,0BAAkB,UAAQ,0BAA0B,EAAE;AAAA,MACxD,QAAQ;AACN,cAAM,IAAI;AAAA,UACR;AAAA,QAEF;AAAA,MACF;AAEA,UAAI,aAAa,KAAK;AACtB,UAAI,CAAC,YAAY;AACf,YAAI;AACJ,YAAI;AAEF,uBAAa,UAAQ,qBAAqB,EAAE;AAAA,QAC9C,QAAQ;AACN,gBAAM,IAAI;AAAA,YACR;AAAA,UAEF;AAAA,QACF;AACA,cAAM,WAAoC;AAAA,UACxC,QAAQ,CAAC,gDAAgD;AAAA,QAC3D;AACA,YAAI,KAAK,UAAW,UAAS,YAAY,KAAK;AAC9C,qBAAa,IAAI,WAAW,QAAQ;AAAA,MACtC;AAEA,YAAM,OAAgC;AAAA,QACpC,QAAQ,KAAK,UAAU;AAAA,QACvB;AAAA,MACF;AACA,UAAI,KAAK,UAAW,MAAK,YAAY,KAAK;AAE1C,WAAK,SAAS,IAAI,gBAAgB,IAAI;AAAA,IACxC;AAEA,SAAK,eAAe,KAAK,SAAS;AAClC,SAAK,cAAc,KAAK;AAAA,EAC1B;AAAA,EAEA,OAAO,KAAK,QAAoD;AAC9D,WAAO;AAAA,MACL,KAAK;AAAA,MACL;AAAA,MACA,KAAK;AAAA,MACL,KAAK;AAAA,IACP;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,14 @@
1
+ import {
2
+ createRenderState,
3
+ isVisibleEvent,
4
+ promptPermission,
5
+ renderEvent
6
+ } from "./chunk-OGXNFXFA.js";
7
+ import "./chunk-DGUM43GV.js";
8
+ export {
9
+ createRenderState,
10
+ isVisibleEvent,
11
+ promptPermission,
12
+ renderEvent
13
+ };
14
+ //# sourceMappingURL=render-GRN4ZSSW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,14 @@
1
+ import {
2
+ DEFAULT_MODELS,
3
+ SUPPORTED_PROVIDERS,
4
+ detectProvider,
5
+ resolveProvider
6
+ } from "./chunk-7ZMN7XJE.js";
7
+ import "./chunk-DGUM43GV.js";
8
+ export {
9
+ DEFAULT_MODELS,
10
+ SUPPORTED_PROVIDERS,
11
+ detectProvider,
12
+ resolveProvider
13
+ };
14
+ //# sourceMappingURL=resolve-XM52G7YE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,128 @@
1
+ import { IncomingMessage, ServerResponse } from 'node:http';
2
+ import { A as Agent } from '../agent-BrkbZyOT.js';
3
+ import '../types-3c88cRKH.js';
4
+ import '../types-CwKKucOF.js';
5
+ import '../types-DwdzmXfs.js';
6
+ import '../cache-DVqaCX8v.js';
7
+ import '../types-2kTLUCnD.js';
8
+ import '@modelcontextprotocol/sdk/client/index.js';
9
+ import '@modelcontextprotocol/sdk/client/auth.js';
10
+ import '@modelcontextprotocol/sdk/shared/auth.js';
11
+
12
+ type MaybePromise<T> = T | Promise<T>;
13
+ interface ServerOptions {
14
+ port: number;
15
+ host?: string;
16
+ /** Enable WebSocket transport (default true). Requires `ws` peer dependency. */
17
+ ws?: boolean;
18
+ auth?: AuthConfig;
19
+ /** Maximum number of concurrent sessions (default unlimited). */
20
+ maxSessions?: number;
21
+ /** Automatically clean up sessions idle longer than this (ms). No timeout by default. */
22
+ idleTimeoutMs?: number;
23
+ /** Called on every new connection; return overrides for the session. */
24
+ onConnection?: (info: ConnectionInfo) => MaybePromise<ConnectionOverrides>;
25
+ onError?: (err: Error) => void;
26
+ /** Enable CORS for browser clients (default true). */
27
+ cors?: boolean;
28
+ /** Timeout for pending permission/input responses before rejecting (ms). Default 120000. */
29
+ pendingTimeoutMs?: number;
30
+ }
31
+ /**
32
+ * Options for `createRequestHandler()` — same as `ServerOptions` but without
33
+ * `port` / `host` / `ws` since the caller owns the HTTP server.
34
+ */
35
+ interface RequestHandlerOptions {
36
+ auth?: AuthConfig;
37
+ maxSessions?: number;
38
+ idleTimeoutMs?: number;
39
+ onConnection?: (info: ConnectionInfo) => MaybePromise<ConnectionOverrides>;
40
+ onError?: (err: Error) => void;
41
+ cors?: boolean;
42
+ pendingTimeoutMs?: number;
43
+ }
44
+ type AuthConfig = {
45
+ type: "bearer";
46
+ token: string;
47
+ } | {
48
+ type: "custom";
49
+ verify: (req: IncomingMessage) => MaybePromise<AuthResult | null>;
50
+ };
51
+ interface AuthResult {
52
+ [key: string]: unknown;
53
+ }
54
+ interface ConnectionInfo {
55
+ auth: AuthResult;
56
+ remoteAddress?: string;
57
+ }
58
+ interface ConnectionOverrides {
59
+ cwd?: string;
60
+ }
61
+ declare class NoumenServer {
62
+ private code;
63
+ private options;
64
+ private httpServer;
65
+ private wss;
66
+ private sessions;
67
+ private idleTimer;
68
+ constructor(code: Agent, options: ServerOptions);
69
+ start(): Promise<void>;
70
+ stop(): Promise<void>;
71
+ getActiveSessions(): Map<string, {
72
+ id: string;
73
+ lastActivity: number;
74
+ done: boolean;
75
+ }>;
76
+ private initWebSocket;
77
+ /**
78
+ * Handle an HTTP request. Used internally by `start()` and exposed for
79
+ * `createRequestHandler()` so the same logic can be mounted on an
80
+ * external Express / Fastify / Hono server.
81
+ */
82
+ handleRequest(req: IncomingMessage, res: ServerResponse): Promise<void>;
83
+ private idleReaperStarted;
84
+ private ensureIdleReaper;
85
+ private handleHttp;
86
+ private authenticate;
87
+ private handleCreateSession;
88
+ private handleListSessions;
89
+ private handleSseStream;
90
+ private handlePermissionResponse;
91
+ private handleInputResponse;
92
+ private handleSendMessage;
93
+ private handleDeleteSession;
94
+ private handleWsConnection;
95
+ private handleWsMessage;
96
+ private createSessionState;
97
+ private makeThread;
98
+ private runAgentSse;
99
+ private runAgentWs;
100
+ private emitSseEvent;
101
+ private bridgePermission;
102
+ private bridgeUserInput;
103
+ private startSseKeepalive;
104
+ private clearSseKeepalive;
105
+ private clearPendingPermissionTimer;
106
+ private clearPendingInputTimer;
107
+ private destroySession;
108
+ private reapIdleSessions;
109
+ private resolveConnectionOverrides;
110
+ }
111
+ declare function createServer(code: Agent, options: ServerOptions): NoumenServer;
112
+ /**
113
+ * Create a `(req, res)` handler that can be mounted on any Node HTTP
114
+ * framework (Express, Fastify, Hono, bare `http.createServer`, etc.).
115
+ *
116
+ * ```ts
117
+ * import express from "express";
118
+ * import { createRequestHandler } from "noumen/server";
119
+ *
120
+ * const app = express();
121
+ * app.use("/agent", createRequestHandler(code, { auth: { type: "bearer", token: "..." } }));
122
+ * ```
123
+ *
124
+ * WebSocket is not supported in middleware mode — use `createServer()` for WS.
125
+ */
126
+ declare function createRequestHandler(code: Agent, options?: RequestHandlerOptions): (req: IncomingMessage, res: ServerResponse) => void;
127
+
128
+ export { type AuthConfig, type AuthResult, type ConnectionInfo, type ConnectionOverrides, NoumenServer, type RequestHandlerOptions, type ServerOptions, createRequestHandler, createServer };