maka-agent 0.2.0-dev.30.20260912 → 0.2.0-dev.31.20260913

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 (194) hide show
  1. package/THIRD_PARTY_NOTICES.txt +392 -0
  2. package/dist/acp/maka-acp-agent.js +8 -2
  3. package/dist/acp/prompt-content.js +225 -0
  4. package/dist/acp/session-event-mapper.js +103 -0
  5. package/dist/acp/session-registry.js +654 -17
  6. package/dist/acp/stdio-server.js +10 -1
  7. package/dist/cli-core.js +1 -1
  8. package/dist/pi-transcript-tools.js +3 -2
  9. package/dist/pi-transcript.js +12 -2
  10. package/dist/runtime-host-session-channel.js +63 -9
  11. package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
  12. package/node_modules/@maka/core/dist/artifacts.js +6 -0
  13. package/node_modules/@maka/core/dist/attachments.js +7 -2
  14. package/node_modules/@maka/core/dist/durable-tool-result-projection.js +3 -1
  15. package/node_modules/@maka/core/dist/events.js +21 -0
  16. package/node_modules/@maka/core/dist/goal.js +44 -2
  17. package/node_modules/@maka/core/dist/permission.js +0 -1
  18. package/node_modules/@maka/core/dist/runtime-boundary.js +73 -29
  19. package/node_modules/@maka/core/dist/runtime-event.js +6 -3
  20. package/node_modules/@maka/core/dist/runtime-handoff.js +10 -2
  21. package/node_modules/@maka/core/dist/runtime-logical-execution.js +39 -14
  22. package/node_modules/@maka/core/dist/tool-result-archive-evidence.js +3 -1
  23. package/node_modules/@maka/core/dist/tool-result-record-schema.js +2 -1
  24. package/node_modules/@maka/core/dist/unified-diff.js +33 -26
  25. package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +49 -178
  26. package/node_modules/@maka/runtime/dist/ai-sdk-message-projection.js +7 -2
  27. package/node_modules/@maka/runtime/dist/ai-sdk-turn.js +15 -53
  28. package/node_modules/@maka/runtime/dist/bash-model-output.js +7 -1
  29. package/node_modules/@maka/runtime/dist/bash-tail-buffer.js +13 -52
  30. package/node_modules/@maka/runtime/dist/builtin-tools.js +59 -111
  31. package/node_modules/@maka/runtime/dist/child-fd-input.js +3 -2
  32. package/node_modules/@maka/runtime/dist/context-budget-policy.js +1 -11
  33. package/node_modules/@maka/runtime/dist/context-budget.js +12 -1
  34. package/node_modules/@maka/runtime/dist/conversation-copy.js +104 -9
  35. package/node_modules/@maka/runtime/dist/filesystem-executor.js +10 -6
  36. package/node_modules/@maka/runtime/dist/filesystem-worker/client.js +77 -19
  37. package/node_modules/@maka/runtime/dist/filesystem-worker/launch-spec.js +66 -55
  38. package/node_modules/@maka/runtime/dist/filesystem-worker/operations.js +34 -97
  39. package/node_modules/@maka/runtime/dist/filesystem-worker/protocol.js +25 -10
  40. package/node_modules/@maka/runtime/dist/filesystem-worker/worker-entry.js +2 -0
  41. package/node_modules/@maka/runtime/dist/glob-search.js +74 -0
  42. package/node_modules/@maka/runtime/dist/goal-continuation.js +78 -8
  43. package/node_modules/@maka/runtime/dist/goal-state.js +7 -0
  44. package/node_modules/@maka/runtime/dist/grep-search.js +155 -0
  45. package/node_modules/@maka/runtime/dist/ledger-tool-result-archive-reader.js +84 -94
  46. package/node_modules/@maka/runtime/dist/model-history.js +25 -3
  47. package/node_modules/@maka/runtime/dist/pipe-tail-collector.js +6 -9
  48. package/node_modules/@maka/runtime/dist/read-page.js +231 -0
  49. package/node_modules/@maka/runtime/dist/request-projection.js +2 -15
  50. package/node_modules/@maka/runtime/dist/ripgrep-executable.js +62 -0
  51. package/node_modules/@maka/runtime/dist/ripgrep-guidance.js +81 -0
  52. package/node_modules/@maka/runtime/dist/runtime-event-read-model.js +187 -20
  53. package/node_modules/@maka/runtime/dist/runtime-read-model.js +2 -1
  54. package/node_modules/@maka/runtime/dist/sandbox/linux-profile-path.js +7 -1
  55. package/node_modules/@maka/runtime/dist/sandbox/linux-sandbox.js +20 -5
  56. package/node_modules/@maka/runtime/dist/session-manager.js +6 -6
  57. package/node_modules/@maka/runtime/dist/session-recap.js +9 -5
  58. package/node_modules/@maka/runtime/dist/shell-exec.js +7 -25
  59. package/node_modules/@maka/runtime/dist/shell-run-manager.js +1 -1
  60. package/node_modules/@maka/runtime/dist/shell-run-tool-result.js +1 -1
  61. package/node_modules/@maka/runtime/dist/shell-tools.js +6 -12
  62. package/node_modules/@maka/runtime/dist/tool-availability.js +0 -1
  63. package/node_modules/@maka/runtime/dist/tool-output.js +1 -1
  64. package/node_modules/@maka/runtime/dist/tool-result-archive-capability.js +24 -36
  65. package/node_modules/@maka/runtime/dist/tool-result-archive-resource.js +32 -527
  66. package/node_modules/@maka/runtime/dist/tool-result-archive-transition.js +17 -119
  67. package/node_modules/@maka/runtime/dist/tool-result-archive.js +7 -25
  68. package/node_modules/@maka/runtime/dist/tool-runtime.js +7 -5
  69. package/node_modules/@maka/runtime/dist/workers/filesystem-worker.js +6933 -3681
  70. package/node_modules/@maka/runtime/dist/workspace-executor.js +20 -24
  71. package/node_modules/@maka/runtime/package.json +2 -0
  72. package/node_modules/@maka/runtime-host/dist/client/host-handoff-copy.js +185 -191
  73. package/node_modules/@maka/runtime-host/dist/client/reconnecting-connection.js +3 -0
  74. package/node_modules/@maka/runtime-host/dist/protocol/index.js +5 -1
  75. package/node_modules/@maka/runtime-host/dist/protocol/message.js +2 -2
  76. package/node_modules/@maka/runtime-host/dist/protocol/operations.js +1 -0
  77. package/node_modules/@maka/runtime-host/dist/protocol/session-continuity.js +2 -2
  78. package/node_modules/@maka/runtime-host/dist/protocol/turn.js +10 -2
  79. package/node_modules/@maka/runtime-host/dist/protocol/workhub-coordination.js +38 -0
  80. package/node_modules/@maka/runtime-host/dist/server/execution-artifacts.js +2 -8
  81. package/node_modules/@maka/runtime-host/dist/server/execution-composition.js +2 -0
  82. package/node_modules/@maka/runtime-host/dist/server/goal-coordinator.js +81 -7
  83. package/node_modules/@maka/runtime-host/dist/server/hosted-execution-tool-profile.js +13 -13
  84. package/node_modules/@maka/runtime-host/dist/server/interaction-coordinator.js +65 -0
  85. package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +1 -0
  86. package/node_modules/@maka/runtime-host/dist/server/session-continuity-coordinator.js +5 -2
  87. package/node_modules/@maka/runtime-host/dist/server/session-transcript-reader.js +88 -72
  88. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-action-gate.js +21 -4
  89. package/node_modules/@maka/runtime-host/dist/server/workhub-coordination-coordinator.js +145 -1
  90. package/node_modules/@maka/storage/dist/agent-run-store.js +5 -2
  91. package/node_modules/@maka/storage/dist/execution-stores.js +2 -1
  92. package/node_modules/@maka/storage/dist/runtime-transcript-query.js +27 -14
  93. package/node_modules/@maka/storage/dist/sqlite-runtime-store.js +69 -3
  94. package/node_modules/balanced-match/LICENSE.md +23 -0
  95. package/node_modules/balanced-match/README.md +57 -0
  96. package/node_modules/balanced-match/dist/commonjs/index.js +59 -0
  97. package/node_modules/balanced-match/dist/commonjs/package.json +3 -0
  98. package/node_modules/balanced-match/dist/esm/index.js +54 -0
  99. package/node_modules/balanced-match/dist/esm/package.json +3 -0
  100. package/node_modules/balanced-match/package.json +68 -0
  101. package/node_modules/brace-expansion/LICENSE +23 -0
  102. package/node_modules/brace-expansion/README.md +105 -0
  103. package/node_modules/brace-expansion/dist/commonjs/index.js +289 -0
  104. package/node_modules/brace-expansion/dist/commonjs/package.json +3 -0
  105. package/node_modules/brace-expansion/dist/esm/index.js +285 -0
  106. package/node_modules/brace-expansion/dist/esm/package.json +3 -0
  107. package/node_modules/brace-expansion/package.json +64 -0
  108. package/node_modules/glob/LICENSE.md +63 -0
  109. package/node_modules/glob/README.md +1203 -0
  110. package/node_modules/glob/dist/commonjs/glob.js +248 -0
  111. package/node_modules/glob/dist/commonjs/has-magic.js +27 -0
  112. package/node_modules/glob/dist/commonjs/ignore.js +119 -0
  113. package/node_modules/glob/dist/commonjs/index.js +68 -0
  114. package/node_modules/glob/dist/commonjs/index.min.js +4 -0
  115. package/node_modules/glob/dist/commonjs/package.json +3 -0
  116. package/node_modules/glob/dist/commonjs/pattern.js +223 -0
  117. package/node_modules/glob/dist/commonjs/processor.js +301 -0
  118. package/node_modules/glob/dist/commonjs/walker.js +387 -0
  119. package/node_modules/glob/dist/esm/glob.js +244 -0
  120. package/node_modules/glob/dist/esm/has-magic.js +23 -0
  121. package/node_modules/glob/dist/esm/ignore.js +115 -0
  122. package/node_modules/glob/dist/esm/index.js +55 -0
  123. package/node_modules/glob/dist/esm/index.min.js +4 -0
  124. package/node_modules/glob/dist/esm/package.json +3 -0
  125. package/node_modules/glob/dist/esm/pattern.js +219 -0
  126. package/node_modules/glob/dist/esm/processor.js +294 -0
  127. package/node_modules/glob/dist/esm/walker.js +381 -0
  128. package/node_modules/glob/package.json +98 -0
  129. package/node_modules/minimatch/LICENSE.md +55 -0
  130. package/node_modules/minimatch/README.md +528 -0
  131. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
  132. package/node_modules/minimatch/dist/commonjs/ast.js +845 -0
  133. package/node_modules/minimatch/dist/commonjs/brace-expressions.js +150 -0
  134. package/node_modules/minimatch/dist/commonjs/escape.js +30 -0
  135. package/node_modules/minimatch/dist/commonjs/index.js +1127 -0
  136. package/node_modules/minimatch/dist/commonjs/package.json +3 -0
  137. package/node_modules/minimatch/dist/commonjs/unescape.js +38 -0
  138. package/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
  139. package/node_modules/minimatch/dist/esm/ast.js +841 -0
  140. package/node_modules/minimatch/dist/esm/brace-expressions.js +146 -0
  141. package/node_modules/minimatch/dist/esm/escape.js +26 -0
  142. package/node_modules/minimatch/dist/esm/index.js +1114 -0
  143. package/node_modules/minimatch/dist/esm/package.json +3 -0
  144. package/node_modules/minimatch/dist/esm/unescape.js +34 -0
  145. package/node_modules/minimatch/package.json +73 -0
  146. package/node_modules/minipass/LICENSE.md +55 -0
  147. package/node_modules/minipass/README.md +825 -0
  148. package/node_modules/minipass/dist/commonjs/index.js +1038 -0
  149. package/node_modules/minipass/dist/commonjs/package.json +3 -0
  150. package/node_modules/minipass/dist/esm/index.js +1020 -0
  151. package/node_modules/minipass/dist/esm/package.json +3 -0
  152. package/node_modules/minipass/package.json +77 -0
  153. package/node_modules/path-scurry/LICENSE.md +55 -0
  154. package/node_modules/path-scurry/README.md +636 -0
  155. package/node_modules/path-scurry/dist/commonjs/index.js +2018 -0
  156. package/node_modules/path-scurry/dist/commonjs/package.json +3 -0
  157. package/node_modules/path-scurry/dist/esm/index.js +1983 -0
  158. package/node_modules/path-scurry/dist/esm/package.json +3 -0
  159. package/node_modules/path-scurry/node_modules/lru-cache/LICENSE.md +55 -0
  160. package/node_modules/path-scurry/node_modules/lru-cache/README.md +469 -0
  161. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/diagnostics-channel.js +7 -0
  162. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.js +1726 -0
  163. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/index.min.js +2 -0
  164. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/browser/perf.js +10 -0
  165. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/diagnostics-channel-cjs.d.cts.map +1 -0
  166. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js +7 -0
  167. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +1726 -0
  168. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.min.js +2 -0
  169. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/diagnostics-channel.js +9 -0
  170. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.js +1726 -0
  171. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/index.min.js +2 -0
  172. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/node/perf.js +10 -0
  173. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/package.json +3 -0
  174. package/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/perf.js +10 -0
  175. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js +4 -0
  176. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.js +1722 -0
  177. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/index.min.js +2 -0
  178. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/browser/perf.js +7 -0
  179. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/diagnostics-channel-esm.d.mts.map +1 -0
  180. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/diagnostics-channel.js +19 -0
  181. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js +1722 -0
  182. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.min.js +2 -0
  183. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js +6 -0
  184. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.js +1722 -0
  185. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/index.min.js +2 -0
  186. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/node/perf.js +7 -0
  187. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/package.json +3 -0
  188. package/node_modules/path-scurry/node_modules/lru-cache/dist/esm/perf.js +7 -0
  189. package/node_modules/path-scurry/node_modules/lru-cache/package.json +154 -0
  190. package/node_modules/path-scurry/package.json +72 -0
  191. package/package.json +1 -1
  192. package/node_modules/@maka/runtime/dist/active-tool-result-prune.js +0 -248
  193. package/node_modules/@maka/runtime/dist/active-tool-result-working-set.js +0 -218
  194. package/node_modules/@maka/runtime/dist/archive-read-tool.js +0 -115
@@ -0,0 +1,248 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Glob = void 0;
4
+ const minimatch_1 = require("minimatch");
5
+ const node_url_1 = require("node:url");
6
+ const path_scurry_1 = require("path-scurry");
7
+ const pattern_js_1 = require("./pattern.js");
8
+ const walker_js_1 = require("./walker.js");
9
+ // if no process global, just call it linux.
10
+ // so we default to case-sensitive, / separators
11
+ const defaultPlatform = (typeof process === 'object' &&
12
+ process &&
13
+ typeof process.platform === 'string') ?
14
+ process.platform
15
+ : 'linux';
16
+ /**
17
+ * An object that can perform glob pattern traversals.
18
+ */
19
+ class Glob {
20
+ absolute;
21
+ cwd;
22
+ root;
23
+ dot;
24
+ dotRelative;
25
+ follow;
26
+ ignore;
27
+ magicalBraces;
28
+ mark;
29
+ matchBase;
30
+ maxDepth;
31
+ nobrace;
32
+ nocase;
33
+ nodir;
34
+ noext;
35
+ noglobstar;
36
+ pattern;
37
+ platform;
38
+ realpath;
39
+ scurry;
40
+ stat;
41
+ signal;
42
+ windowsPathsNoEscape;
43
+ withFileTypes;
44
+ includeChildMatches;
45
+ /**
46
+ * The options provided to the constructor.
47
+ */
48
+ opts;
49
+ /**
50
+ * An array of parsed immutable {@link Pattern} objects.
51
+ */
52
+ patterns;
53
+ /**
54
+ * All options are stored as properties on the `Glob` object.
55
+ *
56
+ * See {@link GlobOptions} for full options descriptions.
57
+ *
58
+ * Note that a previous `Glob` object can be passed as the
59
+ * `GlobOptions` to another `Glob` instantiation to re-use settings
60
+ * and caches with a new pattern.
61
+ *
62
+ * Traversal functions can be called multiple times to run the walk
63
+ * again.
64
+ */
65
+ constructor(pattern, opts) {
66
+ /* c8 ignore start */
67
+ if (!opts)
68
+ throw new TypeError('glob options required');
69
+ /* c8 ignore stop */
70
+ this.withFileTypes = !!opts.withFileTypes;
71
+ this.signal = opts.signal;
72
+ this.follow = !!opts.follow;
73
+ this.dot = !!opts.dot;
74
+ this.dotRelative = !!opts.dotRelative;
75
+ this.nodir = !!opts.nodir;
76
+ this.mark = !!opts.mark;
77
+ if (!opts.cwd) {
78
+ this.cwd = '';
79
+ }
80
+ else if (opts.cwd instanceof URL || opts.cwd.startsWith('file://')) {
81
+ opts.cwd = (0, node_url_1.fileURLToPath)(opts.cwd);
82
+ }
83
+ this.cwd = opts.cwd || '';
84
+ this.root = opts.root;
85
+ this.magicalBraces = !!opts.magicalBraces;
86
+ this.nobrace = !!opts.nobrace;
87
+ this.noext = !!opts.noext;
88
+ this.realpath = !!opts.realpath;
89
+ this.absolute = opts.absolute;
90
+ this.includeChildMatches = opts.includeChildMatches !== false;
91
+ this.noglobstar = !!opts.noglobstar;
92
+ this.matchBase = !!opts.matchBase;
93
+ this.maxDepth =
94
+ typeof opts.maxDepth === 'number' ? opts.maxDepth : Infinity;
95
+ this.stat = !!opts.stat;
96
+ this.ignore = opts.ignore;
97
+ if (this.withFileTypes && this.absolute !== undefined) {
98
+ throw new Error('cannot set absolute and withFileTypes:true');
99
+ }
100
+ if (typeof pattern === 'string') {
101
+ pattern = [pattern];
102
+ }
103
+ this.windowsPathsNoEscape =
104
+ !!opts.windowsPathsNoEscape ||
105
+ opts.allowWindowsEscape ===
106
+ false;
107
+ if (this.windowsPathsNoEscape) {
108
+ pattern = pattern.map(p => p.replace(/\\/g, '/'));
109
+ }
110
+ if (this.matchBase) {
111
+ if (opts.noglobstar) {
112
+ throw new TypeError('base matching requires globstar');
113
+ }
114
+ pattern = pattern.map(p => (p.includes('/') ? p : `./**/${p}`));
115
+ }
116
+ this.pattern = pattern;
117
+ this.platform = opts.platform || defaultPlatform;
118
+ this.opts = { ...opts, platform: this.platform };
119
+ if (opts.scurry) {
120
+ this.scurry = opts.scurry;
121
+ if (opts.nocase !== undefined &&
122
+ opts.nocase !== opts.scurry.nocase) {
123
+ throw new Error('nocase option contradicts provided scurry option');
124
+ }
125
+ }
126
+ else {
127
+ const Scurry = opts.platform === 'win32' ? path_scurry_1.PathScurryWin32
128
+ : opts.platform === 'darwin' ? path_scurry_1.PathScurryDarwin
129
+ : opts.platform ? path_scurry_1.PathScurryPosix
130
+ : path_scurry_1.PathScurry;
131
+ this.scurry = new Scurry(this.cwd, {
132
+ nocase: opts.nocase,
133
+ fs: opts.fs,
134
+ });
135
+ }
136
+ this.nocase = this.scurry.nocase;
137
+ // If you do nocase:true on a case-sensitive file system, then
138
+ // we need to use regexps instead of strings for non-magic
139
+ // path portions, because statting `aBc` won't return results
140
+ // for the file `AbC` for example.
141
+ const nocaseMagicOnly = this.platform === 'darwin' || this.platform === 'win32';
142
+ const mmo = {
143
+ braceExpandMax: 10_000,
144
+ ...opts,
145
+ dot: this.dot,
146
+ matchBase: this.matchBase,
147
+ nobrace: this.nobrace,
148
+ // default nocase based on platform
149
+ nocase: this.nocase,
150
+ nocaseMagicOnly,
151
+ nocomment: true,
152
+ noext: this.noext,
153
+ nonegate: true,
154
+ optimizationLevel: 2,
155
+ platform: this.platform,
156
+ windowsPathsNoEscape: this.windowsPathsNoEscape,
157
+ debug: !!this.opts.debug,
158
+ };
159
+ const mms = this.pattern.map(p => new minimatch_1.Minimatch(p, mmo));
160
+ const [matchSet, globParts] = mms.reduce((set, m) => {
161
+ set[0].push(...m.set);
162
+ set[1].push(...m.globParts);
163
+ return set;
164
+ }, [[], []]);
165
+ this.patterns = matchSet.map((set, i) => {
166
+ const g = globParts[i];
167
+ /* c8 ignore start */
168
+ if (!g)
169
+ throw new Error('invalid pattern object');
170
+ /* c8 ignore stop */
171
+ return new pattern_js_1.Pattern(set, g, 0, this.platform);
172
+ });
173
+ }
174
+ async walk() {
175
+ // Walkers always return array of Path objects, so we just have to
176
+ // coerce them into the right shape. It will have already called
177
+ // realpath() if the option was set to do so, so we know that's cached.
178
+ // start out knowing the cwd, at least
179
+ return [
180
+ ...(await new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
181
+ ...this.opts,
182
+ maxDepth: this.maxDepth !== Infinity ?
183
+ this.maxDepth + this.scurry.cwd.depth()
184
+ : Infinity,
185
+ platform: this.platform,
186
+ nocase: this.nocase,
187
+ includeChildMatches: this.includeChildMatches,
188
+ }).walk()),
189
+ ];
190
+ }
191
+ walkSync() {
192
+ return [
193
+ ...new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
194
+ ...this.opts,
195
+ maxDepth: this.maxDepth !== Infinity ?
196
+ this.maxDepth + this.scurry.cwd.depth()
197
+ : Infinity,
198
+ platform: this.platform,
199
+ nocase: this.nocase,
200
+ includeChildMatches: this.includeChildMatches,
201
+ }).walkSync(),
202
+ ];
203
+ }
204
+ stream() {
205
+ return new walker_js_1.GlobStream(this.patterns, this.scurry.cwd, {
206
+ ...this.opts,
207
+ maxDepth: this.maxDepth !== Infinity ?
208
+ this.maxDepth + this.scurry.cwd.depth()
209
+ : Infinity,
210
+ platform: this.platform,
211
+ nocase: this.nocase,
212
+ includeChildMatches: this.includeChildMatches,
213
+ }).stream();
214
+ }
215
+ streamSync() {
216
+ return new walker_js_1.GlobStream(this.patterns, this.scurry.cwd, {
217
+ ...this.opts,
218
+ maxDepth: this.maxDepth !== Infinity ?
219
+ this.maxDepth + this.scurry.cwd.depth()
220
+ : Infinity,
221
+ platform: this.platform,
222
+ nocase: this.nocase,
223
+ includeChildMatches: this.includeChildMatches,
224
+ }).streamSync();
225
+ }
226
+ /**
227
+ * Default sync iteration function. Returns a Generator that
228
+ * iterates over the results.
229
+ */
230
+ iterateSync() {
231
+ return this.streamSync()[Symbol.iterator]();
232
+ }
233
+ [Symbol.iterator]() {
234
+ return this.iterateSync();
235
+ }
236
+ /**
237
+ * Default async iteration function. Returns an AsyncGenerator that
238
+ * iterates over the results.
239
+ */
240
+ iterate() {
241
+ return this.stream()[Symbol.asyncIterator]();
242
+ }
243
+ [Symbol.asyncIterator]() {
244
+ return this.iterate();
245
+ }
246
+ }
247
+ exports.Glob = Glob;
248
+ //# sourceMappingURL=glob.js.map
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasMagic = void 0;
4
+ const minimatch_1 = require("minimatch");
5
+ /**
6
+ * Return true if the patterns provided contain any magic glob characters,
7
+ * given the options provided.
8
+ *
9
+ * Brace expansion is not considered "magic" unless the `magicalBraces` option
10
+ * is set, as brace expansion just turns one string into an array of strings.
11
+ * So a pattern like `'x{a,b}y'` would return `false`, because `'xay'` and
12
+ * `'xby'` both do not contain any magic glob characters, and it's treated the
13
+ * same as if you had called it on `['xay', 'xby']`. When `magicalBraces:true`
14
+ * is in the options, brace expansion _is_ treated as a pattern having magic.
15
+ */
16
+ const hasMagic = (pattern, options = {}) => {
17
+ if (!Array.isArray(pattern)) {
18
+ pattern = [pattern];
19
+ }
20
+ for (const p of pattern) {
21
+ if (new minimatch_1.Minimatch(p, options).hasMagic())
22
+ return true;
23
+ }
24
+ return false;
25
+ };
26
+ exports.hasMagic = hasMagic;
27
+ //# sourceMappingURL=has-magic.js.map
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ // give it a pattern, and it'll be able to tell you if
3
+ // a given path should be ignored.
4
+ // Ignoring a path ignores its children if the pattern ends in /**
5
+ // Ignores are always parsed in dot:true mode
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.Ignore = void 0;
8
+ const minimatch_1 = require("minimatch");
9
+ const pattern_js_1 = require("./pattern.js");
10
+ const defaultPlatform = (typeof process === 'object' &&
11
+ process &&
12
+ typeof process.platform === 'string') ?
13
+ process.platform
14
+ : 'linux';
15
+ /**
16
+ * Class used to process ignored patterns
17
+ */
18
+ class Ignore {
19
+ relative;
20
+ relativeChildren;
21
+ absolute;
22
+ absoluteChildren;
23
+ platform;
24
+ mmopts;
25
+ constructor(ignored, { nobrace, nocase, noext, noglobstar, platform = defaultPlatform, }) {
26
+ this.relative = [];
27
+ this.absolute = [];
28
+ this.relativeChildren = [];
29
+ this.absoluteChildren = [];
30
+ this.platform = platform;
31
+ this.mmopts = {
32
+ dot: true,
33
+ nobrace,
34
+ nocase,
35
+ noext,
36
+ noglobstar,
37
+ optimizationLevel: 2,
38
+ platform,
39
+ nocomment: true,
40
+ nonegate: true,
41
+ };
42
+ for (const ign of ignored)
43
+ this.add(ign);
44
+ }
45
+ add(ign) {
46
+ // this is a little weird, but it gives us a clean set of optimized
47
+ // minimatch matchers, without getting tripped up if one of them
48
+ // ends in /** inside a brace section, and it's only inefficient at
49
+ // the start of the walk, not along it.
50
+ // It'd be nice if the Pattern class just had a .test() method, but
51
+ // handling globstars is a bit of a pita, and that code already lives
52
+ // in minimatch anyway.
53
+ // Another way would be if maybe Minimatch could take its set/globParts
54
+ // as an option, and then we could at least just use Pattern to test
55
+ // for absolute-ness.
56
+ // Yet another way, Minimatch could take an array of glob strings, and
57
+ // a cwd option, and do the right thing.
58
+ const mm = new minimatch_1.Minimatch(ign, this.mmopts);
59
+ for (let i = 0; i < mm.set.length; i++) {
60
+ const parsed = mm.set[i];
61
+ const globParts = mm.globParts[i];
62
+ /* c8 ignore start */
63
+ if (!parsed || !globParts) {
64
+ throw new Error('invalid pattern object');
65
+ }
66
+ // strip off leading ./ portions
67
+ // https://github.com/isaacs/node-glob/issues/570
68
+ while (parsed[0] === '.' && globParts[0] === '.') {
69
+ parsed.shift();
70
+ globParts.shift();
71
+ }
72
+ /* c8 ignore stop */
73
+ const p = new pattern_js_1.Pattern(parsed, globParts, 0, this.platform);
74
+ const m = new minimatch_1.Minimatch(p.globString(), this.mmopts);
75
+ const children = globParts[globParts.length - 1] === '**';
76
+ const absolute = p.isAbsolute();
77
+ if (absolute)
78
+ this.absolute.push(m);
79
+ else
80
+ this.relative.push(m);
81
+ if (children) {
82
+ if (absolute)
83
+ this.absoluteChildren.push(m);
84
+ else
85
+ this.relativeChildren.push(m);
86
+ }
87
+ }
88
+ }
89
+ ignored(p) {
90
+ const fullpath = p.fullpath();
91
+ const fullpaths = `${fullpath}/`;
92
+ const relative = p.relative() || '.';
93
+ const relatives = `${relative}/`;
94
+ for (const m of this.relative) {
95
+ if (m.match(relative) || m.match(relatives))
96
+ return true;
97
+ }
98
+ for (const m of this.absolute) {
99
+ if (m.match(fullpath) || m.match(fullpaths))
100
+ return true;
101
+ }
102
+ return false;
103
+ }
104
+ childrenIgnored(p) {
105
+ const fullpath = p.fullpath() + '/';
106
+ const relative = (p.relative() || '.') + '/';
107
+ for (const m of this.relativeChildren) {
108
+ if (m.match(relative))
109
+ return true;
110
+ }
111
+ for (const m of this.absoluteChildren) {
112
+ if (m.match(fullpath))
113
+ return true;
114
+ }
115
+ return false;
116
+ }
117
+ }
118
+ exports.Ignore = Ignore;
119
+ //# sourceMappingURL=ignore.js.map
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.glob = exports.sync = exports.iterate = exports.iterateSync = exports.stream = exports.streamSync = exports.Ignore = exports.hasMagic = exports.Glob = exports.unescape = exports.escape = void 0;
4
+ exports.globStreamSync = globStreamSync;
5
+ exports.globStream = globStream;
6
+ exports.globSync = globSync;
7
+ exports.globIterateSync = globIterateSync;
8
+ exports.globIterate = globIterate;
9
+ const minimatch_1 = require("minimatch");
10
+ const glob_js_1 = require("./glob.js");
11
+ const has_magic_js_1 = require("./has-magic.js");
12
+ var minimatch_2 = require("minimatch");
13
+ Object.defineProperty(exports, "escape", { enumerable: true, get: function () { return minimatch_2.escape; } });
14
+ Object.defineProperty(exports, "unescape", { enumerable: true, get: function () { return minimatch_2.unescape; } });
15
+ var glob_js_2 = require("./glob.js");
16
+ Object.defineProperty(exports, "Glob", { enumerable: true, get: function () { return glob_js_2.Glob; } });
17
+ var has_magic_js_2 = require("./has-magic.js");
18
+ Object.defineProperty(exports, "hasMagic", { enumerable: true, get: function () { return has_magic_js_2.hasMagic; } });
19
+ var ignore_js_1 = require("./ignore.js");
20
+ Object.defineProperty(exports, "Ignore", { enumerable: true, get: function () { return ignore_js_1.Ignore; } });
21
+ function globStreamSync(pattern, options = {}) {
22
+ return new glob_js_1.Glob(pattern, options).streamSync();
23
+ }
24
+ function globStream(pattern, options = {}) {
25
+ return new glob_js_1.Glob(pattern, options).stream();
26
+ }
27
+ function globSync(pattern, options = {}) {
28
+ return new glob_js_1.Glob(pattern, options).walkSync();
29
+ }
30
+ async function glob_(pattern, options = {}) {
31
+ return new glob_js_1.Glob(pattern, options).walk();
32
+ }
33
+ function globIterateSync(pattern, options = {}) {
34
+ return new glob_js_1.Glob(pattern, options).iterateSync();
35
+ }
36
+ function globIterate(pattern, options = {}) {
37
+ return new glob_js_1.Glob(pattern, options).iterate();
38
+ }
39
+ // aliases: glob.sync.stream() glob.stream.sync() glob.sync() etc
40
+ exports.streamSync = globStreamSync;
41
+ exports.stream = Object.assign(globStream, { sync: globStreamSync });
42
+ exports.iterateSync = globIterateSync;
43
+ exports.iterate = Object.assign(globIterate, {
44
+ sync: globIterateSync,
45
+ });
46
+ exports.sync = Object.assign(globSync, {
47
+ stream: globStreamSync,
48
+ iterate: globIterateSync,
49
+ });
50
+ exports.glob = Object.assign(glob_, {
51
+ glob: glob_,
52
+ globSync,
53
+ sync: exports.sync,
54
+ globStream,
55
+ stream: exports.stream,
56
+ globStreamSync,
57
+ streamSync: exports.streamSync,
58
+ globIterate,
59
+ iterate: exports.iterate,
60
+ globIterateSync,
61
+ iterateSync: exports.iterateSync,
62
+ Glob: glob_js_1.Glob,
63
+ hasMagic: has_magic_js_1.hasMagic,
64
+ escape: minimatch_1.escape,
65
+ unescape: minimatch_1.unescape,
66
+ });
67
+ exports.glob.glob = exports.glob;
68
+ //# sourceMappingURL=index.js.map