pi-oracle 0.6.0 → 0.6.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.6.1 - 2026-04-13
6
+
7
+ ### Fixed
8
+ - whole-repo archive expansion now merges very large entry groups iteratively instead of using spread/flat patterns that can overflow the JavaScript call stack during `oracle_submit`
9
+ - oracle sanity coverage now guards the large-entry merge path so broad archive submissions regress to a real archive/env error instead of `Maximum call stack size exceeded`
10
+
5
11
  ## 0.6.0 - 2026-04-13
6
12
 
7
13
  ### Added
@@ -155,6 +155,20 @@ type ArchiveCreationResult = {
155
155
  includedEntries: string[];
156
156
  };
157
157
 
158
+ function appendArchiveEntries(target: string[], source: Iterable<string>): void {
159
+ for (const entry of source) target.push(entry);
160
+ }
161
+
162
+ function mergeArchiveEntryGroups(groups: Iterable<Iterable<string>>): string[] {
163
+ const merged: string[] = [];
164
+ for (const group of groups) appendArchiveEntries(merged, group);
165
+ return merged;
166
+ }
167
+
168
+ export function mergeArchiveEntryGroupsForTesting(groups: Iterable<Iterable<string>>): string[] {
169
+ return mergeArchiveEntryGroups(groups);
170
+ }
171
+
158
172
  function pathContainsSequence(relativePath: string, sequence: readonly string[]): boolean {
159
173
  const segments = relativePath.split("/").filter(Boolean);
160
174
  if (sequence.length === 0 || segments.length < sequence.length) return false;
@@ -268,7 +282,7 @@ async function expandArchiveEntries(cwd: string, relativePath: string, options?:
268
282
  for (const child of children.sort((a, b) => a.name.localeCompare(b.name))) {
269
283
  const childRelative = child.name;
270
284
  if (await shouldExcludeArchiveChild(join(cwd, childRelative), childRelative, child)) continue;
271
- if (child.isDirectory()) results.push(...await expandArchiveEntries(cwd, childRelative));
285
+ if (child.isDirectory()) appendArchiveEntries(results, await expandArchiveEntries(cwd, childRelative));
272
286
  else results.push(childRelative);
273
287
  }
274
288
  return results;
@@ -284,7 +298,7 @@ async function expandArchiveEntries(cwd: string, relativePath: string, options?:
284
298
  for (const child of children.sort((a, b) => a.name.localeCompare(b.name))) {
285
299
  const childRelative = posix.join(normalized, child.name);
286
300
  if (await shouldExcludeArchiveChild(join(cwd, childRelative), childRelative, child, { forceInclude: options?.forceIncludeSubtree })) continue;
287
- if (child.isDirectory()) results.push(...await expandArchiveEntries(cwd, childRelative, { forceIncludeSubtree: options?.forceIncludeSubtree }));
301
+ if (child.isDirectory()) appendArchiveEntries(results, await expandArchiveEntries(cwd, childRelative, { forceIncludeSubtree: options?.forceIncludeSubtree }));
288
302
  else results.push(childRelative);
289
303
  }
290
304
  return results;
@@ -294,11 +308,12 @@ async function resolveExpandedArchiveEntriesFromInputs(
294
308
  cwd: string,
295
309
  entries: Array<{ absolute: string; relative: string }>,
296
310
  ): Promise<string[]> {
297
- return Array.from(new Set((await Promise.all(entries.map(async (entry) => {
311
+ const expandedGroups = await Promise.all(entries.map(async (entry) => {
298
312
  const statEntry = await lstat(entry.absolute);
299
313
  const forceIncludeSubtree = statEntry.isDirectory() && entry.relative !== "." && shouldExcludeArchivePath(entry.relative, true);
300
314
  return expandArchiveEntries(cwd, entry.relative, { forceIncludeSubtree });
301
- }))).flat())).sort();
315
+ }));
316
+ return Array.from(new Set(mergeArchiveEntryGroups(expandedGroups))).sort();
302
317
  }
303
318
 
304
319
  export async function resolveExpandedArchiveEntries(cwd: string, files: string[]): Promise<string[]> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-oracle",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "ChatGPT web-oracle extension for pi with isolated browser auth, async jobs, and project-context archives.",
5
5
  "private": false,
6
6
  "license": "MIT",