noumen 0.8.0 → 0.8.1

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.
@@ -1,10 +1,10 @@
1
- import { a as Agent } from '../agent-D0gl-qYi.js';
1
+ import { a as Agent } from '../agent-zlDCYHJx.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
4
  import '../types-DLZNyF5t.js';
5
5
  import '../sandbox-DAqQo0Tj.js';
6
6
  import '../computer-DzMR92tK.js';
7
- import '../types-BX4ALqoN.js';
7
+ import '../types-BRo-F0M-.js';
8
8
  import '../types-2kTLUCnD.js';
9
9
  import '@modelcontextprotocol/sdk/client/index.js';
10
10
  import '@modelcontextprotocol/sdk/client/auth.js';
@@ -1,10 +1,10 @@
1
- import { a as Agent } from '../agent-D0gl-qYi.js';
1
+ import { a as Agent } from '../agent-zlDCYHJx.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 { V as VirtualFs, R as ReadOptions, F as FileEntry, b as FileStat, a as VirtualComputer, E as ExecOptions, C as CommandResult } from '../computer-DzMR92tK.js';
5
5
  import '../types-DLZNyF5t.js';
6
6
  import '../sandbox-DAqQo0Tj.js';
7
- import '../types-BX4ALqoN.js';
7
+ import '../types-BRo-F0M-.js';
8
8
  import '../types-2kTLUCnD.js';
9
9
  import '@modelcontextprotocol/sdk/client/index.js';
10
10
  import '@modelcontextprotocol/sdk/client/auth.js';
@@ -1,6 +1,6 @@
1
1
  import { A as AIProvider, e as ChatMessage, T as ToolDefinition, S as StreamEvent, E as Entry, U as UUID, a 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 PermissionHandler, m as PermissionConfig, n as ThinkingConfig, o as MemoryConfig, O as OutputFormat, d as ContentPart, R as RunOptions, C as CheckpointConfig, p as ToolResult } from './types-DLZNyF5t.js';
2
2
  import { S as Sandbox } from './sandbox-DAqQo0Tj.js';
3
- import { T as Tool, j as DotDirConfig, H as HookDefinition, S as SubagentConfig, k as SubagentRun, l as TaskStore, e as LspServerManager, F as FileCheckpointManager, m as FileStateCacheConfig, i as DotDirResolver, L as LspServerConfig } from './types-BX4ALqoN.js';
3
+ import { T as Tool, j as DotDirConfig, H as HookDefinition, S as SubagentConfig, k as SubagentRun, l as TaskStore, e as LspServerManager, F as FileCheckpointManager, m as FileStateCacheConfig, i as DotDirResolver, L as LspServerConfig } from './types-BRo-F0M-.js';
4
4
  import { M as McpServerConfig, T as TokenStorage } from './types-2kTLUCnD.js';
5
5
  import { V as VirtualFs, a as VirtualComputer } from './computer-DzMR92tK.js';
6
6
 
@@ -1822,7 +1822,6 @@ var SessionStorage = class {
1822
1822
  }
1823
1823
  }
1824
1824
  async listSessions() {
1825
- await this.ensureDir();
1826
1825
  let dirEntries;
1827
1826
  try {
1828
1827
  dirEntries = await this.fs.readdir(this.sessionDir);
@@ -1900,17 +1899,19 @@ var TaskStore = class {
1900
1899
  dir;
1901
1900
  fs;
1902
1901
  nextId = 1;
1903
- initialized = false;
1902
+ nextIdLoaded = false;
1904
1903
  constructor(fs, dir) {
1905
1904
  this.fs = fs;
1906
1905
  this.dir = dir;
1907
1906
  }
1908
- async ensureDir() {
1909
- if (this.initialized) return;
1910
- try {
1911
- await this.fs.mkdir(this.dir, { recursive: true });
1912
- } catch {
1913
- }
1907
+ /**
1908
+ * Best-effort read of the task dir to seed `nextId`. Read-only: if the
1909
+ * dir doesn't exist yet, we leave `nextId` at 1. Does NOT create the dir.
1910
+ * Only called from write paths (`create`) since pure reads don't need it.
1911
+ */
1912
+ async loadNextId() {
1913
+ if (this.nextIdLoaded) return;
1914
+ this.nextIdLoaded = true;
1914
1915
  try {
1915
1916
  const files = await this.fs.readdir(this.dir);
1916
1917
  let maxId = 0;
@@ -1923,13 +1924,24 @@ var TaskStore = class {
1923
1924
  this.nextId = maxId + 1;
1924
1925
  } catch {
1925
1926
  }
1926
- this.initialized = true;
1927
+ }
1928
+ /**
1929
+ * Create the tasks dir if missing. Only called on write paths so that
1930
+ * `get`/`list` remain side-effect-free on filesystems that haven't had
1931
+ * any tasks written yet.
1932
+ */
1933
+ async ensureWriteDir() {
1934
+ try {
1935
+ await this.fs.mkdir(this.dir, { recursive: true });
1936
+ } catch {
1937
+ }
1927
1938
  }
1928
1939
  taskPath(id) {
1929
1940
  return `${this.dir}/${id}.json`;
1930
1941
  }
1931
1942
  async create(input) {
1932
- await this.ensureDir();
1943
+ await this.loadNextId();
1944
+ await this.ensureWriteDir();
1933
1945
  const id = String(this.nextId++);
1934
1946
  const now = (/* @__PURE__ */ new Date()).toISOString();
1935
1947
  const task = {
@@ -1946,7 +1958,6 @@ var TaskStore = class {
1946
1958
  return task;
1947
1959
  }
1948
1960
  async get(id) {
1949
- await this.ensureDir();
1950
1961
  try {
1951
1962
  const content = await this.fs.readFile(this.taskPath(id));
1952
1963
  return JSON.parse(content);
@@ -1955,19 +1966,20 @@ var TaskStore = class {
1955
1966
  }
1956
1967
  }
1957
1968
  async list() {
1958
- await this.ensureDir();
1959
1969
  const tasks = [];
1970
+ let files;
1960
1971
  try {
1961
- const files = await this.fs.readdir(this.dir);
1962
- for (const f of files) {
1963
- if (!f.name.endsWith(".json")) continue;
1964
- try {
1965
- const content = await this.fs.readFile(`${this.dir}/${f.name}`);
1966
- tasks.push(JSON.parse(content));
1967
- } catch {
1968
- }
1969
- }
1972
+ files = await this.fs.readdir(this.dir);
1970
1973
  } catch {
1974
+ return tasks;
1975
+ }
1976
+ for (const f of files) {
1977
+ if (!f.name.endsWith(".json")) continue;
1978
+ try {
1979
+ const content = await this.fs.readFile(`${this.dir}/${f.name}`);
1980
+ tasks.push(JSON.parse(content));
1981
+ } catch {
1982
+ }
1971
1983
  }
1972
1984
  tasks.sort((a, b) => parseInt(a.id, 10) - parseInt(b.id, 10));
1973
1985
  return tasks;
@@ -1981,6 +1993,7 @@ var TaskStore = class {
1981
1993
  if (input.blockedBy !== void 0) {
1982
1994
  task.blockedBy = input.blockedBy;
1983
1995
  const allTasks = await this.list();
1996
+ await this.ensureWriteDir();
1984
1997
  for (const t of allTasks) {
1985
1998
  const blocksIdx = t.blocks.indexOf(id);
1986
1999
  if (input.blockedBy.includes(t.id)) {
@@ -1995,6 +2008,7 @@ var TaskStore = class {
1995
2008
  }
1996
2009
  }
1997
2010
  task.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
2011
+ await this.ensureWriteDir();
1998
2012
  await this.fs.writeFile(this.taskPath(id), JSON.stringify(task, null, 2));
1999
2013
  return task;
2000
2014
  }
@@ -8709,4 +8723,4 @@ export {
8709
8723
  DEFAULT_RETRY_CONFIG,
8710
8724
  Agent
8711
8725
  };
8712
- //# sourceMappingURL=chunk-5HY4IYNT.js.map
8726
+ //# sourceMappingURL=chunk-3XBCLWJY.js.map