@omercnet/paseo-omp 5.4.0-next.391.1 → 5.4.0-next.392.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.
@@ -9,8 +9,8 @@ import { ompStoreKey } from "./omp-store-state";
9
9
  const SESSIONS_POLL_MS = 20_000;
10
10
  const PREVIEW_LIMIT = 20;
11
11
 
12
- function age(epochSeconds: number): string {
13
- const seconds = Math.max(0, Math.floor(Date.now() / 1_000 - epochSeconds));
12
+ function age(updatedAt: string): string {
13
+ const seconds = Math.max(0, Math.floor((Date.now() - Date.parse(updatedAt)) / 1_000));
14
14
  if (seconds < 60) return `${seconds}s ago`;
15
15
  const minutes = Math.floor(seconds / 60);
16
16
  if (minutes < 60) return `${minutes}m ago`;
@@ -52,22 +52,22 @@ export function SessionsPopover(props: PluginButtonContentProps) {
52
52
  [layout.compact, theme],
53
53
  );
54
54
 
55
- if (sessions.isLoading) return <Text style={styles.muted}>Loading omp history…</Text>;
56
- if (sessions.error) return <Text style={styles.error}>Could not read omp history.</Text>;
55
+ if (sessions.isLoading) return <Text style={styles.muted}>Loading OMP sessions…</Text>;
56
+ if (sessions.error) return <Text style={styles.error}>Could not read OMP sessions.</Text>;
57
57
  const items = sessions.data?.sessions ?? [];
58
58
  if (items.length === 0)
59
- return <Text style={styles.muted}>No omp prompts for this directory.</Text>;
59
+ return <Text style={styles.muted}>No OMP sessions for this directory.</Text>;
60
60
 
61
61
  return (
62
62
  <ScrollView contentContainerStyle={styles.root}>
63
63
  <Text style={styles.muted}>{storeLabel(store)}</Text>
64
64
  {items.slice(0, PREVIEW_LIMIT).map((entry) => (
65
- <View key={entry.id} style={styles.row}>
65
+ <View key={entry.sessionId} style={styles.row}>
66
66
  {entry.title ? <Text style={styles.title}>{entry.title}</Text> : null}
67
67
  <Text style={styles.prompt} numberOfLines={3}>
68
- {`${entry.prompt}${entry.truncated ? "…" : ""}`}
68
+ {entry.prompt}
69
69
  </Text>
70
- <Text style={styles.detail}>{age(entry.createdAt)}</Text>
70
+ {entry.updatedAt ? <Text style={styles.detail}>{age(entry.updatedAt)}</Text> : null}
71
71
  </View>
72
72
  ))}
73
73
  {items.length > PREVIEW_LIMIT ? (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omercnet/paseo-omp",
3
- "version": "5.4.0-next.391.1",
3
+ "version": "5.4.0-next.392.1",
4
4
  "type": "module",
5
5
  "description": "Paseo integration for OMP, including its direct provider and workspace tooling.",
6
6
  "license": "MIT",
@@ -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.4.0-next.391.1"; // x-release-please-version
2
+ export const PASEO_OMP_PACKAGE_VERSION = "5.4.0-next.392.1"; // x-release-please-version
@@ -1,58 +1,25 @@
1
- import { join } from "node:path";
2
- import { DatabaseSync } from "node:sqlite";
3
1
  import type { RpcInput } from "@getpaseo/plugin";
4
- import { z } from "zod";
5
2
  import type { listOmpSessions, OmpSessionEntry } from "../shared/sessions";
6
- import { ompDataDir } from "./paths";
3
+ import { currentOmpEnvironment } from "./paths";
4
+ import { listOmpSessionDescriptors } from "./provider/session-descriptors";
7
5
 
8
- const PROMPT_LIMIT = 400;
9
6
  const ROW_LIMIT = 100;
10
7
 
11
- const SessionRowSchema = z.object({
12
- id: z.number().int(),
13
- sessionId: z.string().nullable(),
14
- title: z.string().nullable(),
15
- prompt: z.string(),
16
- createdAt: z.number().int(),
17
- });
18
-
19
- export function listOmpSessionsFrom(path: string, cwd: string): OmpSessionEntry[] {
20
- try {
21
- const database = new DatabaseSync(path, { readOnly: true, timeout: 500 });
22
- try {
23
- const rows = database
24
- .prepare(
25
- `SELECT h.id AS id, h.session_id AS sessionId, t.title AS title,
26
- h.prompt AS prompt, h.created_at AS createdAt
27
- FROM history h
28
- LEFT JOIN session_titles t ON t.session_id = h.session_id
29
- WHERE h.cwd = ?
30
- ORDER BY h.created_at DESC, h.id DESC
31
- LIMIT ?`,
32
- )
33
- .all(cwd, ROW_LIMIT);
34
- return rows.flatMap((row) => {
35
- const parsed = SessionRowSchema.safeParse(row);
36
- if (!parsed.success) return [];
37
- const truncated = parsed.data.prompt.length > PROMPT_LIMIT;
38
- return [
39
- {
40
- ...parsed.data,
41
- prompt: truncated ? parsed.data.prompt.slice(0, PROMPT_LIMIT) : parsed.data.prompt,
42
- truncated,
43
- },
44
- ];
45
- });
46
- } finally {
47
- database.close();
48
- }
49
- } catch {
50
- return [];
51
- }
52
- }
53
-
54
- export function resolveListOmpSessions({ cwd }: RpcInput<typeof listOmpSessions>): {
55
- sessions: OmpSessionEntry[];
56
- } {
57
- return { sessions: listOmpSessionsFrom(join(ompDataDir(), "history.db"), cwd) };
8
+ // OMP records prompt-history rows only from its interactive editor, never in RPC mode, so
9
+ // Paseo-driven sessions are listed from their session files instead.
10
+ export async function resolveListOmpSessions({
11
+ cwd,
12
+ }: RpcInput<typeof listOmpSessions>): Promise<{ sessions: OmpSessionEntry[] }> {
13
+ const descriptors = await listOmpSessionDescriptors(
14
+ { cwd, limit: ROW_LIMIT },
15
+ currentOmpEnvironment(),
16
+ );
17
+ return {
18
+ sessions: descriptors.map((descriptor) => ({
19
+ sessionId: descriptor.id,
20
+ title: descriptor.title ?? null,
21
+ prompt: descriptor.firstPromptPreview ?? descriptor.lastPromptPreview ?? "",
22
+ updatedAt: descriptor.updatedAt ?? null,
23
+ })),
24
+ };
58
25
  }
@@ -4,16 +4,11 @@ import { OmpStoreSchema } from "./omp-store";
4
4
 
5
5
  const CwdSchema = z.string().min(1).max(4_096);
6
6
 
7
- // omp's history.db stores created_at as epoch seconds (confirmed against live rows: 10-digit
8
- // values), unlike agent.db's usage_history which stores milliseconds. Diff against
9
- // Date.now() / 1_000, never Date.now() directly.
10
7
  export const OmpSessionEntrySchema = z.object({
11
- id: z.number().int(),
12
- sessionId: z.string().nullable(),
8
+ sessionId: z.string(),
13
9
  title: z.string().nullable(),
14
10
  prompt: z.string(),
15
- truncated: z.boolean(),
16
- createdAt: z.number().int(),
11
+ updatedAt: z.string().nullable(),
17
12
  });
18
13
  export type OmpSessionEntry = z.infer<typeof OmpSessionEntrySchema>;
19
14