noumen 0.5.0 → 0.6.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 (50) hide show
  1. package/dist/a2a/index.d.ts +4 -4
  2. package/dist/acp/index.d.ts +4 -4
  3. package/dist/{agent-C3eDRsxs.d.ts → agent-DWE4_P5X.d.ts} +179 -6
  4. package/dist/{cache-DsRqxx6v.d.ts → cache-BlBwXXPS.d.ts} +1 -1
  5. package/dist/{chunk-WPCYGZOE.js → chunk-6MMYCGJQ.js} +325 -16
  6. package/dist/chunk-6MMYCGJQ.js.map +1 -0
  7. package/dist/{chunk-WTLK2ZAR.js → chunk-7IQCQI2G.js} +1 -1
  8. package/dist/{chunk-L3L3FG5T.js → chunk-CCM2AXZG.js} +1 -1
  9. package/dist/{chunk-L3L3FG5T.js.map → chunk-CCM2AXZG.js.map} +1 -1
  10. package/dist/{chunk-CS6WNDCF.js → chunk-I3JTUFPK.js} +2 -2
  11. package/dist/chunk-I3JTUFPK.js.map +1 -0
  12. package/dist/{chunk-EKOGVTBT.js → chunk-ZXSDKBYB.js} +4 -2
  13. package/dist/chunk-ZXSDKBYB.js.map +1 -0
  14. package/dist/cli/index.js +6 -6
  15. package/dist/client/index.d.ts +1 -1
  16. package/dist/index.d.ts +16 -9
  17. package/dist/index.js +17 -3
  18. package/dist/lsp/index.d.ts +3 -3
  19. package/dist/mcp/index.d.ts +4 -4
  20. package/dist/{provider-factory-KI7OZUY3.js → provider-factory-TUHU3DIG.js} +2 -2
  21. package/dist/providers/anthropic.d.ts +3 -3
  22. package/dist/providers/anthropic.js +4 -3
  23. package/dist/providers/anthropic.js.map +1 -1
  24. package/dist/providers/bedrock.d.ts +3 -3
  25. package/dist/providers/bedrock.js +2 -2
  26. package/dist/providers/bedrock.js.map +1 -1
  27. package/dist/providers/gemini.d.ts +2 -2
  28. package/dist/providers/gemini.js +1 -1
  29. package/dist/providers/gemini.js.map +1 -1
  30. package/dist/providers/ollama.d.ts +1 -1
  31. package/dist/providers/ollama.js +2 -2
  32. package/dist/providers/openai.d.ts +2 -2
  33. package/dist/providers/openai.js +2 -2
  34. package/dist/providers/openrouter.d.ts +1 -1
  35. package/dist/providers/openrouter.js +2 -2
  36. package/dist/providers/vertex.d.ts +3 -3
  37. package/dist/providers/vertex.js +4 -3
  38. package/dist/providers/vertex.js.map +1 -1
  39. package/dist/{resolve-GDSHNMG6.js → resolve-6KUZNEYW.js} +2 -2
  40. package/dist/server/index.d.ts +4 -4
  41. package/dist/{server-Cu9gv1dk.d.ts → server-BzNGKTP6.d.ts} +1 -1
  42. package/dist/{types-BA87bHPV.d.ts → types-DhXwOQwD.d.ts} +1 -1
  43. package/dist/{types-LrU4LRmX.d.ts → types-kiGBF35b.d.ts} +40 -2
  44. package/package.json +1 -1
  45. package/dist/chunk-CS6WNDCF.js.map +0 -1
  46. package/dist/chunk-EKOGVTBT.js.map +0 -1
  47. package/dist/chunk-WPCYGZOE.js.map +0 -1
  48. /package/dist/{chunk-WTLK2ZAR.js.map → chunk-7IQCQI2G.js.map} +0 -0
  49. /package/dist/{provider-factory-KI7OZUY3.js.map → provider-factory-TUHU3DIG.js.map} +0 -0
  50. /package/dist/{resolve-GDSHNMG6.js.map → resolve-6KUZNEYW.js.map} +0 -0
@@ -1,12 +1,12 @@
1
- import { A as Agent } from '../agent-C3eDRsxs.js';
1
+ import { A as Agent } from '../agent-DWE4_P5X.js';
2
2
  import { A as AgentSkill, a as AgentCard, T as TaskSendParams, b as Task, c as TaskStreamEvent } from '../types-NIyVwQ4h.js';
3
3
  export { d as A2A_METHODS, e as Artifact, D as DataPart, F as FilePart, M as Message, P as Part, f as TaskState, g as TaskStatus, h as TextPart } from '../types-NIyVwQ4h.js';
4
- import '../types-LrU4LRmX.js';
4
+ import '../types-kiGBF35b.js';
5
5
  import '../sandbox-9qeMTNrD.js';
6
6
  import '../computer-BPdxSo6X.js';
7
- import '../types-BA87bHPV.js';
7
+ import '../types-DhXwOQwD.js';
8
8
  import '../types-CD0rUKKT.js';
9
- import '../cache-DsRqxx6v.js';
9
+ import '../cache-BlBwXXPS.js';
10
10
  import '../types-2kTLUCnD.js';
11
11
  import '@modelcontextprotocol/sdk/client/index.js';
12
12
  import '@modelcontextprotocol/sdk/client/auth.js';
@@ -1,12 +1,12 @@
1
- import { A as Agent } from '../agent-C3eDRsxs.js';
1
+ import { A as Agent } from '../agent-DWE4_P5X.js';
2
2
  import { A as AcpTransport } from '../types-QwfylltH.js';
3
3
  export { a as ACP_METHODS, b as AcpCapabilities, c as AcpInitializeParams, d as AcpInitializeResult, e as AcpSessionNewParams, f as AcpSessionPromptParams } from '../types-QwfylltH.js';
4
4
  import { a as VirtualFs, R as ReadOptions, F as FileEntry, b as FileStat, V as VirtualComputer, E as ExecOptions, C as CommandResult } from '../computer-BPdxSo6X.js';
5
- import '../types-LrU4LRmX.js';
5
+ import '../types-kiGBF35b.js';
6
6
  import '../sandbox-9qeMTNrD.js';
7
- import '../types-BA87bHPV.js';
7
+ import '../types-DhXwOQwD.js';
8
8
  import '../types-CD0rUKKT.js';
9
- import '../cache-DsRqxx6v.js';
9
+ import '../cache-BlBwXXPS.js';
10
10
  import '../types-2kTLUCnD.js';
11
11
  import '@modelcontextprotocol/sdk/client/index.js';
12
12
  import '@modelcontextprotocol/sdk/client/auth.js';
@@ -1,7 +1,7 @@
1
- import { A as AIProvider, S as StreamEvent, b as ChatMessage, E as Entry, U as UUID, d as FileCheckpointSnapshot, f as ContentReplacementRecord$1, g as SessionInfo, M as ModelPricing, h as UsageRecord, i as CostSummary, j as ModelUsageSummary, k as ChatCompletionUsage, l as ThinkingConfig, m as MemoryConfig, O as OutputFormat, e as ContentPart, R as RunOptions, c as CheckpointConfig, n as ToolResult } from './types-LrU4LRmX.js';
1
+ import { A as AIProvider, b as ChatMessage, S as StreamEvent, E as Entry, U as UUID, d as FileCheckpointSnapshot, f as ContentReplacementRecord$1, g as SessionInfo, M as ModelPricing, h as UsageRecord, i as CostSummary, j as ModelUsageSummary, k as ChatCompletionUsage, l as ThinkingConfig, m as MemoryConfig, O as OutputFormat, e as ContentPart, R as RunOptions, c as CheckpointConfig, n as ToolResult } from './types-kiGBF35b.js';
2
2
  import { S as Sandbox } from './sandbox-9qeMTNrD.js';
3
- import { T as Tool, H as HookDefinition, S as SubagentConfig, i as SubagentRun, j as TaskStore, e as LspServerManager, F as FileCheckpointManager, k as FileStateCacheConfig, L as LspServerConfig } from './types-BA87bHPV.js';
4
- import { C as CacheControlConfig } from './cache-DsRqxx6v.js';
3
+ import { T as Tool, H as HookDefinition, S as SubagentConfig, i as SubagentRun, j as TaskStore, e as LspServerManager, F as FileCheckpointManager, k as FileStateCacheConfig, L as LspServerConfig } from './types-DhXwOQwD.js';
4
+ import { C as CacheControlConfig } from './cache-BlBwXXPS.js';
5
5
  import { M as McpServerConfig, T as TokenStorage } from './types-2kTLUCnD.js';
6
6
  import { c as PermissionHandler, d as PermissionConfig } from './types-CD0rUKKT.js';
7
7
  import { a as VirtualFs, V as VirtualComputer } from './computer-BPdxSo6X.js';
@@ -27,6 +27,91 @@ declare function resolveProvider(input: AIProvider | ProviderName, opts?: Resolv
27
27
  */
28
28
  declare function detectProvider(): Promise<ProviderName | undefined>;
29
29
 
30
+ /**
31
+ * AI-generated session title helper.
32
+ *
33
+ * Given a short prompt sourced from recent messages, ask a provider to
34
+ * produce a 3–7 word sentence-case title suitable for a session list.
35
+ *
36
+ * This is a pure helper: it never touches the filesystem and never knows
37
+ * about `SessionStorage`. Callers (e.g. `Agent.autoTitleIfMissing`) own
38
+ * persistence and event emission.
39
+ */
40
+
41
+ /**
42
+ * Config for the Agent's opt-in auto-title feature.
43
+ *
44
+ * Pass `true` for defaults (use the Agent's own provider + its
45
+ * `defaultModel`). Pass an object to customise the provider, model,
46
+ * system prompt, or input cap.
47
+ */
48
+ interface AutoTitleConfig {
49
+ /** Master switch. Default false on `AgentOptions.autoTitle`. */
50
+ enabled?: boolean;
51
+ /**
52
+ * Override provider used for title generation. Falls back to the
53
+ * Agent's main provider.
54
+ */
55
+ provider?: AIProvider;
56
+ /**
57
+ * Override model (e.g. `"claude-haiku-4-5"`). Falls back to the
58
+ * provider's `defaultModel`.
59
+ */
60
+ model?: string;
61
+ /** Override system prompt. */
62
+ systemPrompt?: string;
63
+ /** Cap on seed-text characters. Defaults to 2 000. */
64
+ maxInputChars?: number;
65
+ }
66
+ /** Default cap on characters fed to the title model. */
67
+ declare const DEFAULT_AUTO_TITLE_MAX_INPUT_CHARS = 2000;
68
+ /**
69
+ * System prompt for the auto-title generator. Mirrors the shape used by
70
+ * Claude Code so that output quality is familiar.
71
+ */
72
+ declare const DEFAULT_AUTO_TITLE_SYSTEM_PROMPT = "Generate a concise, sentence-case title (3-7 words) that captures the main topic or goal of this coding session. The title should be clear enough that the user recognizes the session in a list. Use sentence case: capitalize only the first word and proper nouns.\n\nReturn JSON with a single \"title\" field.\n\nGood examples:\n{\"title\": \"Fix login button on mobile\"}\n{\"title\": \"Add OAuth authentication\"}\n{\"title\": \"Debug failing CI tests\"}\n{\"title\": \"Refactor API client error handling\"}\n\nBad (too vague): {\"title\": \"Code changes\"}\nBad (too long): {\"title\": \"Investigate and fix the issue where the login button does not respond on mobile devices\"}\nBad (wrong case): {\"title\": \"Fix Login Button On Mobile\"}";
73
+ interface GenerateAutoTitleOptions {
74
+ provider: AIProvider;
75
+ /** Model override. When omitted, uses `provider.defaultModel`. */
76
+ model?: string;
77
+ /** System prompt override. Falls back to the built-in prompt. */
78
+ systemPrompt?: string;
79
+ /** Character cap on the flattened input. Defaults to 2 000. */
80
+ maxInputChars?: number;
81
+ signal?: AbortSignal;
82
+ }
83
+ /**
84
+ * Flatten recent user + assistant text into a single block of plain text
85
+ * suitable for the title model. Tool results are skipped; image parts
86
+ * are skipped; only the tail of the concatenated text is kept when long
87
+ * so the most recent context wins.
88
+ */
89
+ declare function extractTitleSeedText(messages: ChatMessage[], maxChars?: number): string;
90
+ /**
91
+ * Attempt to pull a title out of a free-form model response.
92
+ *
93
+ * Strategy, cheapest-first:
94
+ * 1. Parse the whole string as JSON; return `.title` if present.
95
+ * 2. Slice out the first `{...}` block and `JSON.parse` that.
96
+ * 3. Fall back to the first bare quoted substring in the response.
97
+ *
98
+ * Going through `JSON.parse` (instead of a bespoke regex-unescape) means
99
+ * `\n`, `\\`, `\uXXXX`, and any other valid JSON string escapes round-trip
100
+ * correctly — the previous regex only handled `\"`.
101
+ */
102
+ declare function extractTitleFromResponse(raw: string): string | null;
103
+ /**
104
+ * Drive the provider once to produce a session title. Returns null on
105
+ * empty seed text, empty model output, or provider errors (callers decide
106
+ * whether to retry — this helper never throws).
107
+ */
108
+ declare function generateAutoTitle(messages: ChatMessage[], opts: GenerateAutoTitleOptions): Promise<string | null>;
109
+ /**
110
+ * Trim, collapse whitespace, strip wrapping quotes, clamp length.
111
+ * Returns null if the cleaned string would be empty.
112
+ */
113
+ declare function normalizeTitle(raw: string): string | null;
114
+
30
115
  interface SkillDefinition {
31
116
  name: string;
32
117
  /** Skill body content (after frontmatter is stripped) */
@@ -219,13 +304,36 @@ declare class SessionStorage {
219
304
  appendContentReplacement(sessionId: string, replacements: ContentReplacementRecord$1[]): Promise<void>;
220
305
  appendMetadata(sessionId: string, key: string, value: unknown): Promise<void>;
221
306
  /**
222
- * Re-append custom-title and key metadata entries after a compact boundary
223
- * so they remain discoverable in the active-entries window.
307
+ * Append a user-set session title. Wins over any `ai-title` when read.
308
+ * Idempotent-ish: callers may append as many as they like; the last one
309
+ * wins according to file order.
310
+ */
311
+ appendCustomTitle(sessionId: string, title: string): Promise<void>;
312
+ /**
313
+ * Append an AI-generated session title. A `custom-title` (if present)
314
+ * always takes precedence on read.
315
+ */
316
+ appendAiTitle(sessionId: string, title: string): Promise<void>;
317
+ /**
318
+ * Re-append custom-title, ai-title, and key metadata entries after a
319
+ * compact boundary so they remain discoverable in the active-entries
320
+ * window. Written as a single batched append so a crash mid-write can't
321
+ * leave the transcript with only a subset of the re-emitted entries.
224
322
  */
225
323
  reAppendMetadataAfterCompact(sessionId: string): Promise<void>;
226
324
  loadMessages(sessionId: string): Promise<ChatMessage[]>;
227
325
  loadAllEntries(sessionId: string): Promise<Entry[]>;
228
326
  sessionExists(sessionId: string): Promise<boolean>;
327
+ /**
328
+ * Return the currently persisted titles for a session. `title` reflects
329
+ * the display preference (custom > ai). Returns all-undefined if the
330
+ * session file doesn't exist.
331
+ */
332
+ getSessionTitles(sessionId: string): Promise<{
333
+ title?: string;
334
+ customTitle?: string;
335
+ aiTitle?: string;
336
+ }>;
229
337
  deleteSession(sessionId: string): Promise<void>;
230
338
  listSessions(): Promise<SessionInfo[]>;
231
339
  }
@@ -704,6 +812,17 @@ interface AgentOptions {
704
812
  outputFormat?: OutputFormat;
705
813
  /** Default structured output mode for all threads. */
706
814
  structuredOutputMode?: "alongside_tools" | "final_response";
815
+ /**
816
+ * Opt-in AI-generated session titles. When enabled, callers can invoke
817
+ * `agent.autoTitleIfMissing(sessionId)` (typically once per session,
818
+ * e.g. after the first assistant turn) to produce a short title and
819
+ * persist it as an `ai-title` JSONL entry. User-set `custom-title`
820
+ * entries (see `agent.setCustomTitle`) always take precedence on read.
821
+ *
822
+ * Pass `true` for defaults (same provider as the Agent, provider's
823
+ * default model, built-in prompt) or an object to customise.
824
+ */
825
+ autoTitle?: AutoTitleConfig | boolean;
707
826
  };
708
827
  }
709
828
  interface RunCallbacks {
@@ -777,6 +896,14 @@ declare class Agent {
777
896
  private historySnipConfig;
778
897
  private outputFormat;
779
898
  private structuredOutputMode;
899
+ private autoTitleConfig;
900
+ /**
901
+ * Keyed by `${sessionId}:${force ? "force" : "normal"}`. Parallel calls
902
+ * that pass the same `force` mode coalesce to one in-flight request; a
903
+ * `force: true` call arriving during a normal in-flight request runs its
904
+ * own pass so the caller's intent isn't silently dropped.
905
+ */
906
+ private autoTitleInFlight;
780
907
  private providerPromise;
781
908
  private initPromise;
782
909
  constructor(opts: AgentOptions);
@@ -787,6 +914,52 @@ declare class Agent {
787
914
  private createSpawnSubagent;
788
915
  createThread(opts?: ThreadOptions): Promise<Thread>;
789
916
  listSessions(): Promise<SessionInfo[]>;
917
+ /**
918
+ * Load the message history for a stored session, respecting compact
919
+ * boundaries and history snips. Returns `[]` when the session does
920
+ * not exist. Use this to rehydrate a UI — resuming a Thread for
921
+ * further execution should go through `resumeThread()` instead.
922
+ */
923
+ getMessages(sessionId: string): Promise<ChatMessage[]>;
924
+ /**
925
+ * Persist a user-set title for a session. Takes precedence over any
926
+ * AI-generated title on read. No-op on empty / whitespace-only input.
927
+ */
928
+ setCustomTitle(sessionId: string, title: string): Promise<void>;
929
+ /**
930
+ * Persist an AI-generated title for a session. A user-set title
931
+ * (see `setCustomTitle`) always wins on read, so writing this after a
932
+ * user has renamed the session is harmless.
933
+ */
934
+ setAiTitle(sessionId: string, title: string): Promise<void>;
935
+ /**
936
+ * Delete a session's persisted transcript. Does not affect any
937
+ * currently-running `Thread` reading from the same session id.
938
+ */
939
+ deleteSession(sessionId: string): Promise<void>;
940
+ /**
941
+ * Return the currently persisted titles for a session.
942
+ * `title` reflects the display preference (custom > ai).
943
+ */
944
+ getSessionTitles(sessionId: string): Promise<{
945
+ title?: string;
946
+ customTitle?: string;
947
+ aiTitle?: string;
948
+ }>;
949
+ /**
950
+ * When `autoTitle` is enabled and the session has no title yet,
951
+ * generate one via the configured provider + model and persist it
952
+ * as an `ai-title` entry. Returns the new title on success, or `null`
953
+ * when skipped (feature disabled, title already present, empty seed,
954
+ * or provider error).
955
+ *
956
+ * Concurrency-safe: parallel calls for the same session coalesce to
957
+ * a single in-flight request.
958
+ */
959
+ autoTitleIfMissing(sessionId: string, opts?: {
960
+ signal?: AbortSignal;
961
+ force?: boolean;
962
+ }): Promise<string | null>;
790
963
  getCostSummary(): CostSummary | null;
791
964
  /**
792
965
  * Create a thread that resumes an existing session. Automatically restores
@@ -840,4 +1013,4 @@ declare class Agent {
840
1013
  close(): Promise<void>;
841
1014
  }
842
1015
 
843
- export { createAutoCompactConfig as $, Agent as A, type BudgetState as B, type ContextFile as C, DEFAULT_MODELS as D, type RunCallbacks as E, type RunResult as F, SUPPORTED_PROVIDERS as G, type SnipConfig as H, type SnipResult as I, Thread as J, type ThreadOptions as K, type ToolResultBudgetConfig as L, type MicrocompactConfig as M, type ToolResultBudgetResult as N, type ContentReplacementRecord as O, type ProjectContextConfig as P, type ToolResultSpillResult as Q, type RetryConfig as R, type SkillDefinition as S, type ThreadConfig as T, type ToolResultStorageConfig as U, type TracingConfig as V, type WebSearchConfig as W, type WebSearchResult as X, applyPersistedReplacements as Y, applySnipRemovals as Z, canAutoCompact as _, SessionStorage as a, createAutoCompactTracking as a0, createBudgetState as a1, createContentReplacementState as a2, createWebSearchTool as a3, detectProvider as a4, enforceToolResultBudget as a5, enforceToolResultStorageBudget as a6, microcompactMessages as a7, persistToolResult as a8, projectSnippedView as a9, reconstructContentReplacementState as aa, recordAutoCompactFailure as ab, recordAutoCompactSuccess as ac, resolveProvider as ad, shouldAutoCompact as ae, snipMessagesByUuids as af, tryReactiveCompact as ag, webSearchToolPlaceholder as ah, type ContextScope as b, type RetryContext as c, type RetryEngineOptions as d, type Span as e, type SpanAttributeValue as f, SpanStatusCode as g, type Tracer as h, type SpanOptions as i, type StoredCostState as j, type AgentOptions as k, type AutoCompactConfig as l, type AutoCompactTrackingState as m, CLEARED_PLACEHOLDER as n, COMPACTABLE_TOOLS as o, type ContentReplacementState as p, CostTracker as q, DEFAULT_RETRY_CONFIG as r, type DiagnoseCheckResult as s, type DiagnoseResult as t, type MicrocompactResult as u, type ProviderName as v, type ReactiveCompactConfig as w, type ReactiveCompactResult as x, type ResolveProviderOptions as y, type RetryEvent as z };
1016
+ export { type WebSearchResult as $, Agent as A, type BudgetState as B, type ContextFile as C, DEFAULT_AUTO_TITLE_MAX_INPUT_CHARS as D, type ReactiveCompactResult as E, type ResolveProviderOptions as F, type GenerateAutoTitleOptions as G, type RetryEvent as H, type RunCallbacks as I, type RunResult as J, SUPPORTED_PROVIDERS as K, type SnipConfig as L, type MicrocompactConfig as M, type SnipResult as N, Thread as O, type ProjectContextConfig as P, type ThreadOptions as Q, type RetryConfig as R, type SkillDefinition as S, type ThreadConfig as T, type ToolResultBudgetConfig as U, type ToolResultBudgetResult as V, type ContentReplacementRecord as W, type ToolResultSpillResult as X, type ToolResultStorageConfig as Y, type TracingConfig as Z, type WebSearchConfig as _, type AutoTitleConfig as a, applyPersistedReplacements as a0, applySnipRemovals as a1, canAutoCompact as a2, createAutoCompactConfig as a3, createAutoCompactTracking as a4, createBudgetState as a5, createContentReplacementState as a6, createWebSearchTool as a7, detectProvider as a8, enforceToolResultBudget as a9, enforceToolResultStorageBudget as aa, extractTitleFromResponse as ab, extractTitleSeedText as ac, generateAutoTitle as ad, microcompactMessages as ae, normalizeTitle as af, persistToolResult as ag, projectSnippedView as ah, reconstructContentReplacementState as ai, recordAutoCompactFailure as aj, recordAutoCompactSuccess as ak, resolveProvider as al, shouldAutoCompact as am, snipMessagesByUuids as an, tryReactiveCompact as ao, webSearchToolPlaceholder as ap, SessionStorage as b, type ContextScope as c, type RetryContext as d, type RetryEngineOptions as e, type Span as f, type SpanAttributeValue as g, SpanStatusCode as h, type Tracer as i, type SpanOptions as j, type StoredCostState as k, type AgentOptions as l, type AutoCompactConfig as m, type AutoCompactTrackingState as n, CLEARED_PLACEHOLDER as o, COMPACTABLE_TOOLS as p, type ContentReplacementState as q, CostTracker as r, DEFAULT_AUTO_TITLE_SYSTEM_PROMPT as s, DEFAULT_MODELS as t, DEFAULT_RETRY_CONFIG as u, type DiagnoseCheckResult as v, type DiagnoseResult as w, type MicrocompactResult as x, type ProviderName as y, type ReactiveCompactConfig as z };
@@ -1,4 +1,4 @@
1
- import { b as ChatMessage, T as ToolDefinition } from './types-LrU4LRmX.js';
1
+ import { b as ChatMessage, T as ToolDefinition } from './types-kiGBF35b.js';
2
2
 
3
3
  /**
4
4
  * Provider-agnostic prompt caching utilities.