@nuvin/agent-core 0.2.0-rc.8 → 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 (74) hide show
  1. package/dist/VERSION +2 -2
  2. package/dist/agent/index.js +1 -1
  3. package/dist/chunk-D5IVWJHX.js +1 -1
  4. package/dist/chunk-FFIZ6TKW.js +1 -1
  5. package/dist/chunk-GAZGO6N7.js +1 -0
  6. package/dist/chunk-IUZALP6K.js +1 -1
  7. package/dist/chunk-KIIEBXJF.js +1 -0
  8. package/dist/chunk-LIE76IJA.js +1 -1
  9. package/dist/chunk-X7VAACWY.js +1 -1
  10. package/dist/chunk-YNOIG4FD.js +1 -1
  11. package/dist/formats/index.js +1 -1
  12. package/dist/hooks/index.js +1 -1
  13. package/dist/models/index.d.ts +1 -0
  14. package/dist/models/index.js +1 -1
  15. package/dist/shared/index.js +1 -1
  16. package/dist/shared/types.d.ts +25 -7
  17. package/dist/tools/{internal-tool-runtime.d.ts → core/internal-tool-runtime.d.ts} +1 -1
  18. package/dist/tools/core/mock-tool-runtime.d.ts +3 -0
  19. package/dist/tools/core/runtime-manager-tools.d.ts +132 -0
  20. package/dist/tools/{tool-output-offload.d.ts → core/tool-output-offload.d.ts} +1 -1
  21. package/dist/tools/{tools.d.ts → core/tools.d.ts} +1 -1
  22. package/dist/tools/file-editing/anchored-file-edit.d.ts +53 -0
  23. package/dist/tools/file-editing/anchored-file-errors.d.ts +5 -0
  24. package/dist/tools/file-editing/anchored-file-operations.d.ts +38 -0
  25. package/dist/tools/file-editing/anchored-file-read.d.ts +37 -0
  26. package/dist/tools/file-editing/atomic-file-write.d.ts +19 -0
  27. package/dist/tools/file-editing/file-edit-tool.d.ts +166 -0
  28. package/dist/tools/file-editing/file-mutation-coordinator.d.ts +13 -0
  29. package/dist/tools/{file-new-tool.d.ts → file-editing/file-new-tool.d.ts} +5 -2
  30. package/dist/tools/file-editing/file-observation-store.d.ts +40 -0
  31. package/dist/tools/{file-read-tool.d.ts → file-editing/file-read-tool.d.ts} +8 -2
  32. package/dist/tools/file-editing/file-snapshot.d.ts +16 -0
  33. package/dist/tools/file-editing/hashline-file-edit-adapter.d.ts +19 -0
  34. package/dist/tools/file-editing/structured-file-edit-adapter.d.ts +94 -0
  35. package/dist/tools/file-editing/workspace-paths.d.ts +20 -0
  36. package/dist/tools/index.d.ts +43 -34
  37. package/dist/tools/index.js +1 -1
  38. package/dist/tools/{mcp-connection-generation.d.ts → mcp/mcp-connection-generation.d.ts} +1 -1
  39. package/dist/tools/mcp/mcp-tool-adapter.d.ts +72 -0
  40. package/dist/tools/{glob-tool.d.ts → search/glob-tool.d.ts} +2 -2
  41. package/dist/tools/{grep-tool.d.ts → search/grep-tool.d.ts} +2 -2
  42. package/dist/tools/{ls-tool.d.ts → search/ls-tool.d.ts} +2 -2
  43. package/dist/tools/{view-file-tool.d.ts → search/view-file-tool.d.ts} +2 -2
  44. package/dist/tools/{ask-user-tool.d.ts → session/ask-user-tool.d.ts} +4 -4
  45. package/dist/tools/{lsp-tool.d.ts → session/lsp-tool.d.ts} +5 -5
  46. package/dist/tools/{skill-tool.d.ts → session/skill-tool.d.ts} +2 -2
  47. package/dist/tools/{todo-write-tool.d.ts → session/todo-write-tool.d.ts} +2 -2
  48. package/dist/tools/session/update-topic-tool.d.ts +12 -0
  49. package/dist/tools/{bash-output-tool.d.ts → shell/bash-output-tool.d.ts} +2 -2
  50. package/dist/tools/{bash-tool.d.ts → shell/bash-tool.d.ts} +5 -5
  51. package/dist/tools/{command-tool.d.ts → shell/command-tool.d.ts} +2 -2
  52. package/dist/tools/{kill-shell-tool.d.ts → shell/kill-shell-tool.d.ts} +2 -2
  53. package/dist/tools/{web-fetch-tool.d.ts → web/web-fetch-tool.d.ts} +2 -2
  54. package/dist/tools/{web-search-tool.d.ts → web/web-search-tool.d.ts} +2 -2
  55. package/package.json +3 -2
  56. package/dist/chunk-A4CS4HLK.js +0 -1
  57. package/dist/tools/file-edit-tool.d.ts +0 -34
  58. package/dist/tools/mcp-tool-adapter.d.ts +0 -72
  59. package/dist/tools/mock-tool-runtime.d.ts +0 -3
  60. package/dist/tools/runtime-manager-tools.d.ts +0 -79
  61. package/dist/tools/update-topic-tool.d.ts +0 -12
  62. package/dist/tools/workspace-paths.d.ts +0 -5
  63. /package/dist/tools/{file-mutation.d.ts → file-editing/file-mutation.d.ts} +0 -0
  64. /package/dist/tools/{mcp-oauth-provider.d.ts → mcp/mcp-oauth-provider.d.ts} +0 -0
  65. /package/dist/tools/{mcp-safe-error-provenance.d.ts → mcp/mcp-safe-error-provenance.d.ts} +0 -0
  66. /package/dist/tools/{mcp-safe-error.d.ts → mcp/mcp-safe-error.d.ts} +0 -0
  67. /package/dist/tools/{mcp-server-manager.d.ts → mcp/mcp-server-manager.d.ts} +0 -0
  68. /package/dist/tools/{grep-engine.d.ts → search/grep-engine.d.ts} +0 -0
  69. /package/dist/tools/{ripgrep.d.ts → search/ripgrep.d.ts} +0 -0
  70. /package/dist/tools/{background-process-registry.d.ts → shell/background-process-registry.d.ts} +0 -0
  71. /package/dist/tools/{bash-internals.d.ts → shell/bash-internals.d.ts} +0 -0
  72. /package/dist/tools/{process-tree-termination.d.ts → shell/process-tree-termination.d.ts} +0 -0
  73. /package/dist/tools/{terminal-output-normalizer.d.ts → shell/terminal-output-normalizer.d.ts} +0 -0
  74. /package/dist/tools/{safe-fetch.d.ts → web/safe-fetch.d.ts} +0 -0
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Runtime-wide per-canonical-path async lock.
3
+ *
4
+ * One queued tail per canonical path; a new caller chains behind the live
5
+ * tail and becomes the new tail. The map entry is removed only when that
6
+ * exact tail settles, so a stale settled tail never blocks later callers and
7
+ * a rejected task cannot poison the queue.
8
+ */
9
+ export declare class FileMutationCoordinator {
10
+ private readonly tails;
11
+ runExclusive<T>(canonicalPath: string, signal: AbortSignal, task: () => Promise<T>): Promise<T>;
12
+ }
13
+ //# sourceMappingURL=file-mutation-coordinator.d.ts.map
@@ -1,12 +1,15 @@
1
+ import type { FileObservationStore } from "./file-observation-store.ts";
1
2
  export interface FileNewToolOptions {
2
3
  allowedDirs?: readonly string[];
3
4
  defaultCwd?: string;
4
5
  name?: string;
6
+ observations?: FileObservationStore;
7
+ anchored?: boolean;
5
8
  }
6
- export declare function createFileNewTool(options?: FileNewToolOptions): import("../shared/types.ts").ToolDefinition<{
9
+ export declare function createFileNewTool(options?: FileNewToolOptions): import("../../shared/types.ts").ToolDefinition<{
7
10
  content: string;
8
11
  filePath: string;
9
- }, import("../shared/types.ts").ToolOutputEnvelope, undefined, {
12
+ }, import("../../shared/types.ts").ToolOutputEnvelope, undefined, {
10
13
  type: "object";
11
14
  properties: {
12
15
  filePath: {
@@ -0,0 +1,40 @@
1
+ import type { NormalizedFileSnapshot } from "./file-snapshot.ts";
2
+ export declare const FILE_OBSERVATION_LIMITS: {
3
+ readonly maxPaths: 30;
4
+ readonly maxVersionsPerPath: 4;
5
+ readonly maxSnapshotBytes: number;
6
+ };
7
+ export interface ObservedFileSnapshot {
8
+ snapshot: NormalizedFileSnapshot;
9
+ observedLines: ReadonlySet<number>;
10
+ }
11
+ export interface FileObservationStoreOptions {
12
+ limits?: {
13
+ maxPaths: number;
14
+ maxVersionsPerPath: number;
15
+ maxSnapshotBytes: number;
16
+ };
17
+ tagForDigest?: (digest: string) => string;
18
+ }
19
+ export declare class FileObservationStore {
20
+ private readonly limits;
21
+ private readonly tagForDigest?;
22
+ private sessionId;
23
+ private versionsByPath;
24
+ private recency;
25
+ private totalBytes;
26
+ private bytesByDigest;
27
+ private noChangeCounters;
28
+ constructor(options?: FileObservationStoreOptions);
29
+ bindSession(sessionId: string): void;
30
+ record(snapshot: NormalizedFileSnapshot, observedLines: readonly number[]): ObservedFileSnapshot;
31
+ resolve(canonicalPath: string, tag: string): ObservedFileSnapshot;
32
+ recordNoChange(canonicalPath: string, payloadDigest: string): number;
33
+ resetNoChange(canonicalPath: string): void;
34
+ clear(): void;
35
+ private touchPath;
36
+ private evictLeastRecentlyUsedPath;
37
+ private acquireBytes;
38
+ private releaseBytes;
39
+ }
40
+ //# sourceMappingURL=file-observation-store.d.ts.map
@@ -1,13 +1,19 @@
1
+ import type { ToolOutputEnvelope } from "../../shared/types.ts";
2
+ import type { FileObservationStore } from "./file-observation-store.ts";
3
+ import type { FileEditMode } from "./structured-file-edit-adapter.ts";
1
4
  export interface FileReadToolOptions {
2
5
  allowedDirs?: readonly string[];
3
6
  defaultCwd?: string;
4
7
  name?: string;
8
+ mode?: FileEditMode;
9
+ observations?: FileObservationStore;
10
+ outputBudgetBytes?: number;
5
11
  }
6
- export declare function createFileReadTool(options?: FileReadToolOptions): import("../shared/types.ts").ToolDefinition<{
12
+ export declare function createFileReadTool(options?: FileReadToolOptions): import("../../shared/types.ts").ToolDefinition<{
7
13
  path: string;
8
14
  lineStart?: number | undefined;
9
15
  lineEnd?: number | undefined;
10
- }, import("../shared/types.ts").ToolOutputEnvelope, undefined, {
16
+ }, ToolOutputEnvelope, undefined, {
11
17
  type: "object";
12
18
  properties: {
13
19
  path: {
@@ -0,0 +1,16 @@
1
+ export type FileEol = "lf" | "crlf";
2
+ export interface NormalizedFileSnapshot {
3
+ canonicalPath: string;
4
+ text: string;
5
+ lines: readonly string[];
6
+ finalNewline: boolean;
7
+ bom: boolean;
8
+ eol: FileEol;
9
+ digest: string;
10
+ tag: string;
11
+ utf8Bytes: number;
12
+ recordedAt: number;
13
+ }
14
+ export declare function createNormalizedFileSnapshot(canonicalPath: string, bytes: Uint8Array, recordedAt?: number): NormalizedFileSnapshot;
15
+ export declare function serializeNormalizedFile(text: string, style: Pick<NormalizedFileSnapshot, "bom" | "eol">): Buffer;
16
+ //# sourceMappingURL=file-snapshot.d.ts.map
@@ -0,0 +1,19 @@
1
+ import { type CanonicalAnchoredEditRequest } from "./structured-file-edit-adapter.ts";
2
+ export declare const hashlineFileEditInputSchema: {
3
+ readonly type: "object";
4
+ readonly properties: {
5
+ readonly patch: {
6
+ readonly type: "string";
7
+ };
8
+ readonly description: {
9
+ readonly type: "string";
10
+ };
11
+ readonly dryRun: {
12
+ readonly type: "boolean";
13
+ };
14
+ };
15
+ readonly required: readonly ["patch"];
16
+ readonly additionalProperties: false;
17
+ };
18
+ export declare function parseHashlineFileEditInput(input: unknown): CanonicalAnchoredEditRequest;
19
+ //# sourceMappingURL=hashline-file-edit-adapter.d.ts.map
@@ -0,0 +1,94 @@
1
+ import type { CanonicalFileOperation } from "./anchored-file-operations.ts";
2
+ export type FileEditMode = "exact" | "anchored-json" | "hashline";
3
+ export type AnchoredFileEditMode = Exclude<FileEditMode, "exact">;
4
+ export interface CanonicalAnchoredEditRequest {
5
+ filePath: string;
6
+ tag: string;
7
+ description?: string;
8
+ operations: readonly CanonicalFileOperation[];
9
+ dryRun: boolean;
10
+ }
11
+ export declare const MAX_ANCHORED_OPERATIONS = 100;
12
+ export declare const MAX_ANCHORED_CONTENT_BYTES: number;
13
+ export declare const structuredFileEditInputSchema: {
14
+ readonly type: "object";
15
+ readonly properties: {
16
+ readonly filePath: {
17
+ readonly type: "string";
18
+ };
19
+ readonly tag: {
20
+ readonly type: "string";
21
+ };
22
+ readonly description: {
23
+ readonly type: "string";
24
+ };
25
+ readonly operations: {
26
+ readonly type: "array";
27
+ readonly items: {
28
+ readonly anyOf: readonly [{
29
+ readonly type: "object";
30
+ readonly properties: {
31
+ readonly operation: {
32
+ readonly type: "string";
33
+ readonly enum: readonly ["replace"];
34
+ };
35
+ readonly startLine: {
36
+ readonly type: "number";
37
+ };
38
+ readonly endLine: {
39
+ readonly type: "number";
40
+ };
41
+ readonly content: {
42
+ readonly type: "string";
43
+ };
44
+ };
45
+ readonly required: readonly ["operation", "startLine", "endLine", "content"];
46
+ readonly additionalProperties: false;
47
+ }, {
48
+ readonly type: "object";
49
+ readonly properties: {
50
+ readonly operation: {
51
+ readonly type: "string";
52
+ readonly enum: readonly ["delete"];
53
+ };
54
+ readonly startLine: {
55
+ readonly type: "number";
56
+ };
57
+ readonly endLine: {
58
+ readonly type: "number";
59
+ };
60
+ };
61
+ readonly required: readonly ["operation", "startLine", "endLine"];
62
+ readonly additionalProperties: false;
63
+ }, {
64
+ readonly type: "object";
65
+ readonly properties: {
66
+ readonly operation: {
67
+ readonly type: "string";
68
+ readonly enum: readonly ["insert"];
69
+ };
70
+ readonly position: {
71
+ readonly type: "string";
72
+ readonly enum: readonly ["before", "after"];
73
+ };
74
+ readonly line: {
75
+ readonly type: "number";
76
+ };
77
+ readonly content: {
78
+ readonly type: "string";
79
+ };
80
+ };
81
+ readonly required: readonly ["operation", "position", "line", "content"];
82
+ readonly additionalProperties: false;
83
+ }];
84
+ };
85
+ };
86
+ readonly dryRun: {
87
+ readonly type: "boolean";
88
+ };
89
+ };
90
+ readonly required: readonly ["filePath", "tag", "operations"];
91
+ readonly additionalProperties: false;
92
+ };
93
+ export declare function parseStructuredFileEditInput(input: unknown): CanonicalAnchoredEditRequest;
94
+ //# sourceMappingURL=structured-file-edit-adapter.d.ts.map
@@ -0,0 +1,20 @@
1
+ export declare function resolveWorkspacePath(rootDir: string, inputPath: string): string;
2
+ export declare function resolveAllowedPath(rootDir: string, allowedDirs: readonly string[], inputPath: string): string;
3
+ export interface CanonicalAllowedFile {
4
+ authoredPath: string;
5
+ lexicalPath: string;
6
+ canonicalPath: string;
7
+ }
8
+ /**
9
+ * Anchored-only canonical authorization.
10
+ *
11
+ * The exact lexical `resolveAllowedPath()` check always runs first and is
12
+ * authoritative for rejection. The target and every currently live allowed
13
+ * root are then re-resolved with `realpath()` on each call; roots that no
14
+ * longer exist are discarded. The canonical target must sit inside one
15
+ * canonical root and `stat()` must show a regular file.
16
+ */
17
+ export declare function resolveCanonicalAllowedFile(rootDir: string, allowedDirs: readonly string[], inputPath: string): Promise<CanonicalAllowedFile>;
18
+ export declare function assertWorkspaceFile(filePath: string): Promise<void>;
19
+ export declare function isProbablyBinary(buffer: Buffer): boolean;
20
+ //# sourceMappingURL=workspace-paths.d.ts.map
@@ -1,36 +1,45 @@
1
1
  export * from "../lsp/index.ts";
2
- export * from "./ask-user-tool.ts";
3
- export * from "./background-process-registry.ts";
4
- export * from "./bash-output-tool.ts";
5
- export * from "./bash-tool.ts";
6
- export * from "./command-tool.ts";
7
- export * from "./file-edit-tool.ts";
8
- export * from "./file-mutation.ts";
9
- export * from "./file-new-tool.ts";
10
- export * from "./file-read-tool.ts";
11
- export * from "./glob-tool.ts";
12
- export * from "./grep-engine.ts";
13
- export * from "./grep-tool.ts";
14
- export * from "./internal-tool-runtime.ts";
15
- export * from "./kill-shell-tool.ts";
16
- export * from "./ls-tool.ts";
17
- export * from "./lsp-tool.ts";
18
- export * from "./mcp-connection-generation.ts";
19
- export * from "./mcp-oauth-provider.ts";
20
- export * from "./mcp-safe-error.ts";
21
- export { extractOwnedMcpSafeError } from "./mcp-safe-error-provenance.ts";
22
- export * from "./mcp-server-manager.ts";
23
- export * from "./mcp-tool-adapter.ts";
24
- export * from "./mock-tool-runtime.ts";
25
- export * from "./ripgrep.ts";
26
- export * from "./runtime-manager-tools.ts";
27
- export * from "./skill-tool.ts";
28
- export * from "./todo-write-tool.ts";
29
- export * from "./tool-output-offload.ts";
30
- export * from "./tools.ts";
31
- export * from "./update-topic-tool.ts";
32
- export * from "./view-file-tool.ts";
33
- export * from "./web-fetch-tool.ts";
34
- export * from "./web-search-tool.ts";
35
- export * from "./workspace-paths.ts";
2
+ export * from "./core/internal-tool-runtime.ts";
3
+ export * from "./core/mock-tool-runtime.ts";
4
+ export * from "./core/runtime-manager-tools.ts";
5
+ export * from "./core/tool-output-offload.ts";
6
+ export * from "./core/tools.ts";
7
+ export { type AnchoredFileEditEnvironment, type AnchoredFileEditStructuredResult, type CanonicalFileEditPreview, executeAnchoredFileEdit, MAX_ANCHORED_PREVIEW_BYTES, prepareAnchoredFileEditApproval, } from "./file-editing/anchored-file-edit.ts";
8
+ export * from "./file-editing/anchored-file-errors.ts";
9
+ export * from "./file-editing/anchored-file-operations.ts";
10
+ export * from "./file-editing/anchored-file-read.ts";
11
+ export * from "./file-editing/file-edit-tool.ts";
12
+ export * from "./file-editing/file-mutation.ts";
13
+ export * from "./file-editing/file-mutation-coordinator.ts";
14
+ export * from "./file-editing/file-new-tool.ts";
15
+ export * from "./file-editing/file-observation-store.ts";
16
+ export * from "./file-editing/file-read-tool.ts";
17
+ export * from "./file-editing/file-snapshot.ts";
18
+ export { hashlineFileEditInputSchema } from "./file-editing/hashline-file-edit-adapter.ts";
19
+ export { type AnchoredFileEditMode, type CanonicalAnchoredEditRequest, type FileEditMode, MAX_ANCHORED_CONTENT_BYTES, MAX_ANCHORED_OPERATIONS, structuredFileEditInputSchema, } from "./file-editing/structured-file-edit-adapter.ts";
20
+ export * from "./file-editing/workspace-paths.ts";
21
+ export * from "./mcp/mcp-connection-generation.ts";
22
+ export * from "./mcp/mcp-oauth-provider.ts";
23
+ export * from "./mcp/mcp-safe-error.ts";
24
+ export { extractOwnedMcpSafeError } from "./mcp/mcp-safe-error-provenance.ts";
25
+ export * from "./mcp/mcp-server-manager.ts";
26
+ export * from "./mcp/mcp-tool-adapter.ts";
27
+ export * from "./search/glob-tool.ts";
28
+ export * from "./search/grep-engine.ts";
29
+ export * from "./search/grep-tool.ts";
30
+ export * from "./search/ls-tool.ts";
31
+ export * from "./search/ripgrep.ts";
32
+ export * from "./search/view-file-tool.ts";
33
+ export * from "./session/ask-user-tool.ts";
34
+ export * from "./session/lsp-tool.ts";
35
+ export * from "./session/skill-tool.ts";
36
+ export * from "./session/todo-write-tool.ts";
37
+ export * from "./session/update-topic-tool.ts";
38
+ export * from "./shell/background-process-registry.ts";
39
+ export * from "./shell/bash-output-tool.ts";
40
+ export * from "./shell/bash-tool.ts";
41
+ export * from "./shell/command-tool.ts";
42
+ export * from "./shell/kill-shell-tool.ts";
43
+ export * from "./web/web-fetch-tool.ts";
44
+ export * from "./web/web-search-tool.ts";
36
45
  //# sourceMappingURL=index.d.ts.map