@myagentroam/agent 0.11.73 → 0.12.0

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.
@@ -37,6 +37,8 @@ export interface AgentSessionImage {
37
37
  /** Public session catalog facade. Storage details remain SDK-private. */
38
38
  export interface AgentSessionCatalog {
39
39
  list(input?: SessionListInput): Promise<AgentSessionPage>;
40
+ /** Complete, detached metadata from one directory read; unordered and without history reads. */
41
+ listSnapshot(): Promise<AgentSessionSummary[]>;
40
42
  firstUserMessagePreview(sessionId: string): Promise<string | undefined>;
41
43
  executionConfiguration(sessionId: string): Promise<{
42
44
  readonly modelId: string;
@@ -86,5 +88,5 @@ export type OpenAgentSessionCatalogInput = {
86
88
  sessionStore: SessionStore;
87
89
  homeDirectory?: never;
88
90
  };
89
- export declare function createSessionCatalog(store: Pick<SessionStore, 'list' | 'firstUserMessagePreview' | 'executionConfiguration' | 'readPage' | 'readInputImage' | 'readResource' | 'readToolResultResource' | 'forkSession' | 'rollbackSession' | 'clearSession' | 'delete' | 'acquireSessionMaintenance' | 'close'>, borrowed: boolean): AgentSessionCatalog;
91
+ export declare function createSessionCatalog(store: Pick<SessionStore, 'list' | 'listSnapshot' | 'firstUserMessagePreview' | 'executionConfiguration' | 'readPage' | 'readInputImage' | 'readResource' | 'readToolResultResource' | 'forkSession' | 'rollbackSession' | 'clearSession' | 'delete' | 'acquireSessionMaintenance' | 'close'>, borrowed: boolean): AgentSessionCatalog;
90
92
  export declare function imageMetadata(value: unknown): AgentSessionHistoryImageMetadata[];
@@ -17,6 +17,10 @@ export function createSessionCatalog(store, borrowed) {
17
17
  assertOpen();
18
18
  return store.list(options);
19
19
  },
20
+ listSnapshot: async () => {
21
+ assertOpen();
22
+ return store.listSnapshot();
23
+ },
20
24
  firstUserMessagePreview: async (sessionId) => {
21
25
  assertOpen();
22
26
  return store.firstUserMessagePreview(sessionId);
@@ -75,6 +75,8 @@ export interface SessionStore {
75
75
  automaticTitlePending: boolean;
76
76
  }>;
77
77
  list(input?: SessionListInput): Promise<AgentSessionPage>;
78
+ /** Complete, detached metadata from one directory read; unordered and without history reads. */
79
+ listSnapshot(): Promise<AgentSessionSummary[]>;
78
80
  listSubagentChildren(parentSessionId: string): Promise<Array<AgentSessionSummary & {
79
81
  source: Extract<SessionSource, {
80
82
  type: 'subagent';
@@ -119,6 +119,18 @@ export declare class JsonlSessionStore implements SessionStore {
119
119
  /** Native writes join their Agent's sole writer, without admitting another Execution. */
120
120
  acquireSessionWriteLease(sessionId: string, owner: object): Promise<() => Promise<void>>;
121
121
  retainSessionLease(sessionId: string, owner: object): Promise<() => Promise<void>>;
122
+ listSnapshot(): Promise<{
123
+ reasoningEffort?: string;
124
+ modelName?: string;
125
+ modelId?: string;
126
+ workspace: string;
127
+ createdAt: string;
128
+ lastActivityAt: string;
129
+ source: SessionSource;
130
+ firstUserMessagePreview?: string;
131
+ id: string;
132
+ title: string;
133
+ }[]>;
122
134
  list(input?: SessionListInput): Promise<{
123
135
  nextCursor?: string;
124
136
  sessions: {
@@ -1704,16 +1704,8 @@ export class JsonlSessionStore {
1704
1704
  throw error;
1705
1705
  }
1706
1706
  }
1707
- async list(input = {}) {
1708
- this.#assertOpen();
1709
- await this.#refreshIndex();
1710
- const filter = sessionListFilter(input);
1711
- const start = decodeSessionListCursor(input.cursor, this.#shared.index.revision, filter);
1712
- const limit = Math.min(200, Math.max(1, input.limit ?? 50));
1713
- const ordered = this.#shared.index.sessions
1714
- .filter((session) => sessionMatchesFilter(session, filter))
1715
- .sort((a, b) => b.lastActivityAt.localeCompare(a.lastActivityAt));
1716
- const sessions = ordered.slice(start, start + limit).map((session) => ({
1707
+ #sessionSummary(session) {
1708
+ return {
1717
1709
  id: session.id,
1718
1710
  title: session.title,
1719
1711
  ...(session.resume?.firstUserMessagePreview === undefined
@@ -1722,7 +1714,7 @@ export class JsonlSessionStore {
1722
1714
  workspace: session.workspace,
1723
1715
  createdAt: session.createdAt,
1724
1716
  lastActivityAt: session.lastActivityAt,
1725
- source: normalizeSessionSource(session.source),
1717
+ source: structuredClone(normalizeSessionSource(session.source)),
1726
1718
  ...(session.resume?.modelId === undefined
1727
1719
  ? {}
1728
1720
  : {
@@ -1734,7 +1726,25 @@ export class JsonlSessionStore {
1734
1726
  ? {}
1735
1727
  : { reasoningEffort: session.resume.reasoningEffort })
1736
1728
  })
1737
- }));
1729
+ };
1730
+ }
1731
+ async listSnapshot() {
1732
+ this.#assertOpen();
1733
+ await this.#refreshIndex();
1734
+ return this.#shared.index.sessions.map((session) => this.#sessionSummary(session));
1735
+ }
1736
+ async list(input = {}) {
1737
+ this.#assertOpen();
1738
+ await this.#refreshIndex();
1739
+ const filter = sessionListFilter(input);
1740
+ const start = decodeSessionListCursor(input.cursor, this.#shared.index.revision, filter);
1741
+ const limit = Math.min(200, Math.max(1, input.limit ?? 50));
1742
+ const ordered = this.#shared.index.sessions
1743
+ .filter((session) => sessionMatchesFilter(session, filter))
1744
+ .sort((a, b) => b.lastActivityAt.localeCompare(a.lastActivityAt));
1745
+ const sessions = ordered
1746
+ .slice(start, start + limit)
1747
+ .map((session) => this.#sessionSummary(session));
1738
1748
  const next = start + limit < ordered.length
1739
1749
  ? encodeSessionListCursor(this.#shared.index.revision, start + limit, filter)
1740
1750
  : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myagentroam/agent",
3
- "version": "0.11.73",
3
+ "version": "0.12.0",
4
4
  "description": "Embeddable MAR coding agent SDK and CLI.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",