@omercnet/paseo-omp 5.1.1-next.352.1 → 5.1.1-next.355.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omercnet/paseo-omp",
3
- "version": "5.1.1-next.352.1",
3
+ "version": "5.1.1-next.355.1",
4
4
  "type": "module",
5
5
  "description": "Paseo integration for OMP, including its direct provider and workspace tooling.",
6
6
  "license": "MIT",
@@ -77,7 +77,7 @@
77
77
  "tsx": "^4.20.6",
78
78
  "typescript": "^7.0.2",
79
79
  "vitest": "^5.0.0",
80
- "zod": "4.4.3"
80
+ "zod": "4.6.6"
81
81
  },
82
82
  "overrides": {
83
83
  "qs": "6.16.1"
@@ -1,2 +1,2 @@
1
1
  /** Release Please keeps this bundle-safe constant aligned with package.json. */
2
- export const PASEO_OMP_PACKAGE_VERSION = "5.1.1-next.352.1"; // x-release-please-version
2
+ export const PASEO_OMP_PACKAGE_VERSION = "5.1.1-next.355.1"; // x-release-please-version
@@ -893,6 +893,7 @@ export function createOmpConnection(
893
893
  query: input.query,
894
894
  limit: input.limit,
895
895
  sessionDir: listingConfig.sessionDir,
896
+ signal: shutdown.signal,
896
897
  })
897
898
  ).map((session) => ({
898
899
  persistence: { version: 1, data: { sessionId: session.id } },
@@ -997,6 +998,7 @@ export function createOmpConnection(
997
998
  environment,
998
999
  hostInheritEnv,
999
1000
  scheduler,
1001
+ controller.signal,
1000
1002
  )
1001
1003
  : await OmpProviderSession.open(
1002
1004
  input,
@@ -10,12 +10,11 @@ const MAX_DESCRIPTOR_PREFIX_BYTES = 64 * 1024;
10
10
  const MAX_DESCRIPTOR_SUFFIX_BYTES = 64 * 1024;
11
11
  const MAX_PROMPT_PREVIEW_CHARS = 160;
12
12
  const MAX_DIRECTORY_DEPTH = 8;
13
- // Count caps only bound memory; the byte and time budgets bound scan work. OMP keeps one
14
- // directory per workspace, so these must exceed real session trees or lookups silently miss.
13
+ // No wall-clock cutoff: it silently drops sessions on a slow disk. OMP keeps one directory per
14
+ // workspace, so the count caps must exceed real session trees or lookups silently miss.
15
15
  const MAX_SCAN_DIRECTORIES = 65_536;
16
16
  const MAX_SCAN_FILES = 262_144;
17
17
  const MAX_SCAN_BYTES = 16 * 1024 * 1024;
18
- const MAX_SCAN_MS = 1_000;
19
18
  const SCAN_YIELD_INTERVAL = 128;
20
19
  const MAX_LIST_RESULTS = 500;
21
20
  const MAX_CHILD_TRANSCRIPT_BYTES = 16 * 1024 * 1024;
@@ -59,10 +58,10 @@ export interface OmpSessionListOptions {
59
58
  limit?: number;
60
59
  sessionId?: string;
61
60
  sessionDir?: string;
61
+ signal?: AbortSignal;
62
62
  }
63
63
 
64
64
  interface ScanBudget {
65
- startedAt: number;
66
65
  directories: number;
67
66
  files: number;
68
67
  bytes: number;
@@ -155,8 +154,7 @@ function budgetExceeded(budget: ScanBudget): boolean {
155
154
  budget.exhausted ||
156
155
  budget.directories >= MAX_SCAN_DIRECTORIES ||
157
156
  budget.files >= MAX_SCAN_FILES ||
158
- budget.bytes >= MAX_SCAN_BYTES ||
159
- Date.now() - budget.startedAt >= MAX_SCAN_MS
157
+ budget.bytes >= MAX_SCAN_BYTES
160
158
  );
161
159
  }
162
160
 
@@ -418,11 +416,13 @@ async function scanSessionFiles(
418
416
  root: string,
419
417
  budget: ScanBudget,
420
418
  visit: (file: string) => Promise<boolean>,
419
+ signal?: AbortSignal,
421
420
  ): Promise<void> {
422
421
  const pending: Array<{ path: string; depth: number }> = [{ path: root, depth: 0 }];
423
422
  while (pending.length > 0 && !budgetExceeded(budget)) {
424
423
  const current = pending.pop();
425
424
  if (!current) return;
425
+ signal?.throwIfAborted();
426
426
  budget.directories += 1;
427
427
  let directory: Dir;
428
428
  try {
@@ -432,6 +432,7 @@ async function scanSessionFiles(
432
432
  }
433
433
  try {
434
434
  for await (const entry of directory) {
435
+ signal?.throwIfAborted();
435
436
  budget.entries += 1;
436
437
  if (budget.entries % SCAN_YIELD_INTERVAL === 0) await yieldToEventLoop();
437
438
  if (budgetExceeded(budget)) return;
@@ -469,7 +470,6 @@ export async function listOmpSessionDescriptors(
469
470
  const query = options.query?.trim().toLowerCase();
470
471
  const matches: OmpSessionDescriptor[] = [];
471
472
  const budget: ScanBudget = {
472
- startedAt: Date.now(),
473
473
  directories: 0,
474
474
  files: 0,
475
475
  bytes: 0,
@@ -481,29 +481,35 @@ export async function listOmpSessionDescriptors(
481
481
  ? join(environment.HOME ?? environment.USERPROFILE ?? homedir(), options.sessionDir.slice(2))
482
482
  : resolve(options.cwd ?? homedir(), options.sessionDir)
483
483
  : ompSessionDir(environment);
484
- await scanSessionFiles(root, budget, async (file) => {
485
- const fileName = basename(file);
486
- const stem = fileName.slice(0, -".jsonl".length);
487
- if (requestedId && !stem.endsWith(`_${requestedId}`)) return true;
488
- const descriptor = await parseDescriptor(file, budget);
489
- if (
490
- !descriptor ||
491
- !stem.endsWith(`_${descriptor.id}`) ||
492
- (options.cwd !== undefined && descriptor.cwd !== options.cwd)
493
- )
494
- return !budgetExceeded(budget);
495
- if (
496
- query &&
497
- !descriptor.id.toLowerCase().includes(query) &&
498
- !descriptor.title?.toLowerCase().includes(query) &&
499
- !descriptor.firstPromptPreview?.toLowerCase().includes(query) &&
500
- !descriptor.lastPromptPreview?.toLowerCase().includes(query)
501
- ) {
502
- return !budgetExceeded(budget);
503
- }
504
- retainNewest(matches, descriptor, retentionLimit);
505
- return !requestedId || matches.length < 2;
506
- });
484
+ await scanSessionFiles(
485
+ root,
486
+ budget,
487
+ async (file) => {
488
+ const fileName = basename(file);
489
+ const stem = fileName.slice(0, -".jsonl".length);
490
+ if (requestedId && !stem.endsWith(`_${requestedId}`)) return true;
491
+ const descriptor = await parseDescriptor(file, budget);
492
+ if (
493
+ !descriptor ||
494
+ !stem.endsWith(`_${descriptor.id}`) ||
495
+ (options.cwd !== undefined && descriptor.cwd !== options.cwd)
496
+ )
497
+ return !budgetExceeded(budget);
498
+ if (
499
+ query &&
500
+ !descriptor.id.toLowerCase().includes(query) &&
501
+ !descriptor.title?.toLowerCase().includes(query) &&
502
+ !descriptor.firstPromptPreview?.toLowerCase().includes(query) &&
503
+ !descriptor.lastPromptPreview?.toLowerCase().includes(query)
504
+ ) {
505
+ return !budgetExceeded(budget);
506
+ }
507
+ retainNewest(matches, descriptor, retentionLimit);
508
+ return !requestedId || matches.length < 2;
509
+ },
510
+ options.signal,
511
+ );
512
+ options.signal?.throwIfAborted();
507
513
  return matches;
508
514
  }
509
515
 
@@ -119,6 +119,7 @@ export class OmpHistorySession implements OmpOpenedSession {
119
119
  environment?: NodeJS.ProcessEnv,
120
120
  hostInheritEnv: readonly string[] = [],
121
121
  scheduler: OmpTimelineScheduler = defaultOmpTimelineScheduler,
122
+ signal?: AbortSignal,
122
123
  ): Promise<OmpHistorySession> {
123
124
  const nativeSessionId = ompPersistenceSessionId(input);
124
125
  if (!nativeSessionId || input.history !== "replay" || !input.config.persist) {
@@ -141,6 +142,7 @@ export class OmpHistorySession implements OmpOpenedSession {
141
142
  nativeSessionId,
142
143
  input.config.cwd,
143
144
  normalized.sessionDir,
145
+ signal,
144
146
  );
145
147
  if (!descriptor.transcriptFile) {
146
148
  throw new OmpPublicError("OMP session transcript could not be resolved in this workspace");
@@ -228,8 +228,9 @@ export async function authorizeNativeSession(
228
228
  sessionId: string,
229
229
  cwd: string,
230
230
  sessionDir?: string,
231
+ signal?: AbortSignal,
231
232
  ): Promise<OmpSessionDescriptor> {
232
- const matches = await runtime.listSessions({ sessionId, cwd, limit: 2, sessionDir });
233
+ const matches = await runtime.listSessions({ sessionId, cwd, limit: 2, sessionDir, signal });
233
234
  const descriptor = matches[0];
234
235
  if (matches.length !== 1 || descriptor?.id !== sessionId) {
235
236
  throw new OmpPublicError("OMP session could not be resolved in this workspace");
@@ -542,6 +543,7 @@ export class OmpProviderSession implements OmpOpenedSession, OmpSubagentControls
542
543
  resumeSessionId,
543
544
  input.config.cwd,
544
545
  normalizedConfig.sessionDir,
546
+ signal,
545
547
  )
546
548
  : undefined;
547
549
  validateOmpHostToolConfig(effectiveConfig);