@nexrall/code-core 1.4.71 → 1.4.73

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 (126) hide show
  1. package/dist/agent/agentRegistry.d.ts.map +1 -1
  2. package/dist/agent/agentRegistry.js +28 -10
  3. package/dist/agent/agentTypes.d.ts.map +1 -1
  4. package/dist/agent/agentTypes.js +159 -48
  5. package/dist/agent/askOnce.d.ts.map +1 -1
  6. package/dist/agent/askOnce.js +14 -5
  7. package/dist/agent/backgroundAgents.d.ts.map +1 -1
  8. package/dist/agent/backgroundAgents.js +22 -8
  9. package/dist/agent/claimEvidence.d.ts.map +1 -1
  10. package/dist/agent/claimEvidence.js +2 -1
  11. package/dist/agent/compaction.d.ts.map +1 -1
  12. package/dist/agent/compaction.js +31 -10
  13. package/dist/agent/crossProcessLock.d.ts.map +1 -1
  14. package/dist/agent/crossProcessLock.js +14 -6
  15. package/dist/agent/editCompleteness.d.ts.map +1 -1
  16. package/dist/agent/fileLocks.d.ts.map +1 -1
  17. package/dist/agent/fileLocks.js +14 -5
  18. package/dist/agent/flaky.d.ts.map +1 -1
  19. package/dist/agent/hooks.d.ts.map +1 -1
  20. package/dist/agent/hooks.js +284 -75
  21. package/dist/agent/iterationPolicy.d.ts.map +1 -1
  22. package/dist/agent/iterationPolicy.js +26 -23
  23. package/dist/agent/lifecycleHost.d.ts.map +1 -1
  24. package/dist/agent/lifecycleHost.js +35 -11
  25. package/dist/agent/loop.d.ts +22 -4
  26. package/dist/agent/loop.d.ts.map +1 -1
  27. package/dist/agent/loop.js +238 -51
  28. package/dist/agent/memory.d.ts.map +1 -1
  29. package/dist/agent/memory.js +13 -7
  30. package/dist/agent/modelCatalogue.d.ts.map +1 -1
  31. package/dist/agent/modelCatalogue.js +4 -1
  32. package/dist/agent/nestedInstructions.d.ts +122 -0
  33. package/dist/agent/nestedInstructions.d.ts.map +1 -0
  34. package/dist/agent/nestedInstructions.js +696 -0
  35. package/dist/agent/peerRegistry.d.ts.map +1 -1
  36. package/dist/agent/peerRegistry.js +44 -6
  37. package/dist/agent/peerTransport.d.ts.map +1 -1
  38. package/dist/agent/peerTransport.js +18 -6
  39. package/dist/agent/planMode.d.ts.map +1 -1
  40. package/dist/agent/planMode.js +194 -41
  41. package/dist/agent/readDedupe.d.ts.map +1 -1
  42. package/dist/agent/readDedupe.js +3 -1
  43. package/dist/agent/securityLint.d.ts.map +1 -1
  44. package/dist/agent/sharedTasks.d.ts.map +1 -1
  45. package/dist/agent/sharedTasks.js +20 -5
  46. package/dist/agent/skills.d.ts +79 -0
  47. package/dist/agent/skills.d.ts.map +1 -1
  48. package/dist/agent/skills.js +403 -14
  49. package/dist/agent/subAgentBudget.d.ts.map +1 -1
  50. package/dist/agent/subTask.d.ts.map +1 -1
  51. package/dist/agent/subTask.js +87 -37
  52. package/dist/agent/subTaskSupport.d.ts.map +1 -1
  53. package/dist/agent/subTaskSupport.js +43 -14
  54. package/dist/agent/testIntegrity.d.ts.map +1 -1
  55. package/dist/agent/testIntegrity.js +4 -2
  56. package/dist/agent/toolDescriptions.d.ts.map +1 -1
  57. package/dist/agent/toolPrefetch.d.ts.map +1 -1
  58. package/dist/agent/toolPrefetch.js +15 -11
  59. package/dist/agent/trust.d.ts.map +1 -1
  60. package/dist/agent/trust.js +6 -2
  61. package/dist/agent/worktree.d.ts.map +1 -1
  62. package/dist/agent/worktree.js +70 -16
  63. package/dist/agent/worktreeEnforcement.d.ts.map +1 -1
  64. package/dist/agent/worktreeEnforcement.js +9 -4
  65. package/dist/api/client.d.ts +6 -0
  66. package/dist/api/client.d.ts.map +1 -1
  67. package/dist/api/client.js +64 -31
  68. package/dist/auth/index.d.ts.map +1 -1
  69. package/dist/auth/index.js +3 -1
  70. package/dist/checkpoint/manager.d.ts.map +1 -1
  71. package/dist/checkpoint/manager.js +22 -7
  72. package/dist/commands/loader.d.ts.map +1 -1
  73. package/dist/commands/loader.js +6 -1
  74. package/dist/index.d.ts +2 -0
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +2 -0
  77. package/dist/mcp/client.d.ts +42 -0
  78. package/dist/mcp/client.d.ts.map +1 -1
  79. package/dist/mcp/client.js +89 -24
  80. package/dist/mcp/httpClient.d.ts +24 -1
  81. package/dist/mcp/httpClient.d.ts.map +1 -1
  82. package/dist/mcp/httpClient.js +80 -14
  83. package/dist/mcp/instructions.d.ts +11 -0
  84. package/dist/mcp/instructions.d.ts.map +1 -0
  85. package/dist/mcp/instructions.js +42 -0
  86. package/dist/mcp/manager.d.ts +35 -0
  87. package/dist/mcp/manager.d.ts.map +1 -1
  88. package/dist/mcp/manager.js +135 -24
  89. package/dist/mcp/server.d.ts.map +1 -1
  90. package/dist/mcp/server.js +48 -14
  91. package/dist/mcp/sseClient.d.ts +9 -1
  92. package/dist/mcp/sseClient.d.ts.map +1 -1
  93. package/dist/mcp/sseClient.js +43 -10
  94. package/dist/mcp/stats.d.ts.map +1 -1
  95. package/dist/permissions/bashClassify.d.ts.map +1 -1
  96. package/dist/permissions/bashClassify.js +25 -3
  97. package/dist/permissions/destructive.d.ts.map +1 -1
  98. package/dist/permissions/destructive.js +7 -2
  99. package/dist/permissions/destructiveTokens.d.ts.map +1 -1
  100. package/dist/permissions/destructiveTokens.js +104 -24
  101. package/dist/permissions/modePolicy.d.ts.map +1 -1
  102. package/dist/permissions/modePolicy.js +40 -17
  103. package/dist/permissions/rules.d.ts.map +1 -1
  104. package/dist/permissions/rules.js +7 -5
  105. package/dist/plugins/data.d.ts.map +1 -1
  106. package/dist/plugins/data.js +6 -2
  107. package/dist/plugins/index.d.ts.map +1 -1
  108. package/dist/plugins/index.js +18 -7
  109. package/dist/plugins/installer.d.ts.map +1 -1
  110. package/dist/plugins/installer.js +17 -10
  111. package/dist/plugins/sources.d.ts.map +1 -1
  112. package/dist/plugins/sources.js +9 -3
  113. package/dist/tools/executor.d.ts.map +1 -1
  114. package/dist/tools/executor.js +454 -168
  115. package/dist/tools/sandbox.d.ts.map +1 -1
  116. package/dist/tools/sandbox.js +5 -1
  117. package/dist/tools/symbols.d.ts.map +1 -1
  118. package/dist/tools/symbols.js +30 -8
  119. package/dist/tools/tsLangService.d.ts.map +1 -1
  120. package/dist/tools/tsLangService.js +12 -4
  121. package/dist/types.d.ts +17 -0
  122. package/dist/types.d.ts.map +1 -1
  123. package/dist/util/frontmatter.d.ts.map +1 -1
  124. package/dist/util/miniYaml.d.ts.map +1 -1
  125. package/dist/util/miniYaml.js +3 -1
  126. package/package.json +1 -1
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Caps: discovered files ride the system prompt on EVERY request of the session, so a
3
+ * pathological (or hostile, from a cloned repo) subdirectory file must not be able to
4
+ * crowd out the real project brief. Truncation is visible; the same pattern as the
5
+ * MCP-instructions caps.
6
+ */
7
+ export declare const NESTED_INSTRUCTIONS_PER_FILE = 4000;
8
+ export declare const NESTED_INSTRUCTIONS_TOTAL = 12000;
9
+ /**
10
+ * The InstructionsLoaded `load_reason` a file is announced with — CC's own vocabulary.
11
+ * `session_start`: loaded up front (root unconditional rules). `nested_traversal`: a
12
+ * directory the agent worked in carries the file. `path_glob_match`: a `paths:`-scoped
13
+ * rule matched a touched path.
14
+ */
15
+ export type InstructionLoadReason = 'nested_traversal' | 'path_glob_match' | 'session_start';
16
+ /** One discovered instruction file, as loaded. */
17
+ export interface NestedInstruction {
18
+ /** Absolute path of the instruction file. */
19
+ filePath: string;
20
+ /** Project-relative path, `/`-separated (e.g. `src/foo/nexrall.md`) — the label the prompt shows. */
21
+ relPath: string;
22
+ /** Instruction text (frontmatter stripped for rules). Trimmed. Replaced in place by refresh(). */
23
+ content: string;
24
+ /** Subdirectory brief (`nexrall.md`) or rule file (`.nexrall/rules/*.md`) — the prompt label. */
25
+ kind: 'brief' | 'rule';
26
+ /** Why this file entered context — what the InstructionsLoaded hook reports. */
27
+ loadReason: InstructionLoadReason;
28
+ }
29
+ /**
30
+ * Compile one `paths:` glob to an anchored RegExp over project-relative POSIX paths,
31
+ * or null when the pattern is empty / fails to compile (callers treat null as
32
+ * non-matching). Compiled once per pattern string, cached for the process.
33
+ */
34
+ export declare function pathGlobToRegExp(pattern: string): RegExp | null;
35
+ /**
36
+ * Read the `paths:` (alias `globs:`) frontmatter of a rule file. Returns null when
37
+ * there is no frontmatter, the key is absent, or it lists nothing — all of which mean
38
+ * UNCONDITIONAL. Accepts the three shapes CC's docs and real files use: a block list
39
+ * (`paths:\n - glob`), a comma-separated string, and a flow list (`["a", "b"]`).
40
+ * Only top-level keys count — an indented `paths:` inside a nested map is that map's
41
+ * field, the same isolation util/frontmatter applies.
42
+ */
43
+ export declare function extractPathGlobs(raw: string): string[] | null;
44
+ /**
45
+ * Discovers `nexrall.md` briefs and `.nexrall/rules` files as the agent works (see the
46
+ * section comment above). Stateful across calls by design — the loaded set IS the
47
+ * feature (and the callback dedupe), so the host that owns a session keeps ONE
48
+ * instance and passes it to every run.
49
+ */
50
+ export declare class NestedInstructionScanner {
51
+ private readonly workDir;
52
+ private readonly loaded;
53
+ private readonly ignored;
54
+ /** dir → the real on-disk path of its brief (casing resolved once, on the first hit). */
55
+ private readonly resolved;
56
+ /** rule file → parsed metadata: globs (null = unconditional) + frontmatter-stripped body. */
57
+ private readonly ruleMeta;
58
+ /** Root unconditional rules load once per session state; refresh() re-arms. */
59
+ private rootInitialized;
60
+ constructor(workDir: string);
61
+ /**
62
+ * Load the root's unconditional rules and return them — the HOST calls this at
63
+ * session start so they are announced with `session_start` alongside the brief and
64
+ * memory. A host that skips it still gets the rules from the first `list()`; it
65
+ * just has no announcement to make.
66
+ */
67
+ initialRules(): NestedInstruction[];
68
+ /**
69
+ * Scan the tool input of one call for filesystem paths and return the instruction
70
+ * files this call loaded (usually none). A failed tool call still scans: intent
71
+ * marks the area even when the file itself was missing.
72
+ */
73
+ scanInput(input: Record<string, unknown>): NestedInstruction[];
74
+ /** Scan the ancestor chain of one touched path; returns the files newly loaded by this call. */
75
+ scanPath(touched: string): NestedInstruction[];
76
+ /** Everything loaded so far, parent-first — what the prompt renders. */
77
+ list(): NestedInstruction[];
78
+ /**
79
+ * Re-read every loaded file from disk; files that no longer exist are dropped.
80
+ * The `/reload` escape hatch for content edits — returns how many entries changed
81
+ * or vanished, so a caller can report it (0 = nothing to say). Root rules are
82
+ * re-listed, so an unconditional rule file created since the session started (or
83
+ * one whose frontmatter lost its `paths:`) joins here; new path-scoped files load
84
+ * on their next matching touch.
85
+ */
86
+ refresh(): number;
87
+ /** Root unconditional rules: root listing once per session state, `session_start`. */
88
+ private ensureRootRules;
89
+ /** Root path-scoped rules matching this touch ('path_glob_match'). */
90
+ private scanRootRulesFor;
91
+ /**
92
+ * Rules a directory carries (`<dir>/.nexrall/rules`): unconditional ones load with
93
+ * the touch (`nested_traversal` — the same timing as that directory's brief);
94
+ * path-scoped ones load when this touch matches (`path_glob_match`).
95
+ */
96
+ private scanRulesDir;
97
+ /**
98
+ * Load one rule file if it should be — dedupe, parse, scope decision. `fallbackReason`
99
+ * is the reason an UNCONDITIONAL rule loads with; `relTouched` (null = no touch yet)
100
+ * is what path-scoped globs are tested against. Returns the new entry or null.
101
+ */
102
+ private loadRule;
103
+ /** Parsed metadata for a rule file, cached until refresh(). */
104
+ private ruleMetaOf;
105
+ /**
106
+ * The instruction file a directory carries, or null. A directory WITHOUT one is
107
+ * re-checked on every touch (see the header), so a file created after the first scan
108
+ * is still found; a directory WITH one is resolved once — the ledger keeps its
109
+ * content, and deletion is `refresh()`'s business.
110
+ */
111
+ private checkDir;
112
+ }
113
+ /**
114
+ * Render the discovered-instructions block, or null when there is nothing to inject —
115
+ * callers join the result with the project brief, and a null must not leave an empty
116
+ * section behind. Parent-first order makes a deeper file (the more specific one) read
117
+ * as the refinement of its ancestors, which is also how Claude Code orders nested
118
+ * CLAUDE.md context. Rules carry their own label so a file like `.nexrall/rules/x.md`
119
+ * is not mistaken for a subdirectory brief.
120
+ */
121
+ export declare function formatNestedInstructions(files: NestedInstruction[]): string | null;
122
+ //# sourceMappingURL=nested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