@myagentroam/agent 0.9.131 → 0.9.133

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.
@@ -7,6 +7,9 @@ export interface MarAgentSessionSummary {
7
7
  createdAt: string;
8
8
  lastActivityAt: string;
9
9
  source: SessionSource;
10
+ modelId?: string;
11
+ modelName?: string;
12
+ reasoningEffort?: string;
10
13
  }
11
14
  export interface MarAgentSessionPage {
12
15
  sessions: MarAgentSessionSummary[];
@@ -50,6 +53,11 @@ export interface MarAgentSessionImage {
50
53
  /** Public session catalog facade. Storage details remain SDK-private. */
51
54
  export interface MarAgentSessionCatalog {
52
55
  list(input?: SessionListInput): Promise<MarAgentSessionPage>;
56
+ executionConfiguration(sessionId: string): Promise<{
57
+ readonly modelId: string;
58
+ readonly modelName?: string;
59
+ readonly reasoningEffort?: string;
60
+ } | undefined>;
53
61
  history(sessionId: string, input?: {
54
62
  limit?: number;
55
63
  cursor?: string;
@@ -6,6 +6,7 @@ export async function openMarAgentSessionCatalog(input) {
6
6
  const store = await JsonlSessionStore.open(input.homeDirectory);
7
7
  return {
8
8
  list: (options) => store.list(options),
9
+ executionConfiguration: (sessionId) => store.executionConfiguration(sessionId),
9
10
  history: async (sessionId, options = {}) => {
10
11
  const beforeSequence = parseCursor(options.cursor);
11
12
  const page = await store.readPage(sessionId, {
@@ -62,6 +62,10 @@ interface SessionMeta {
62
62
  gcBaseSequence?: number;
63
63
  todoSequence?: number;
64
64
  todoRevision: number;
65
+ executionModelIndexed?: true;
66
+ modelId?: string;
67
+ modelName?: string;
68
+ reasoningEffort?: string;
65
69
  };
66
70
  segments?: Array<{
67
71
  number: number;
@@ -170,6 +174,9 @@ export declare class JsonlSessionStore {
170
174
  list(input?: SessionListInput): Promise<{
171
175
  nextCursor?: string;
172
176
  sessions: {
177
+ reasoningEffort?: string;
178
+ modelName?: string;
179
+ modelId?: string;
173
180
  id: string;
174
181
  title: string;
175
182
  workspace: string;
@@ -179,6 +186,9 @@ export declare class JsonlSessionStore {
179
186
  }[];
180
187
  }>;
181
188
  listSubagentChildren(parentSessionId: string): Promise<{
189
+ reasoningEffort?: string;
190
+ modelName?: string;
191
+ modelId?: string;
182
192
  id: string;
183
193
  title: string;
184
194
  workspace: string;
@@ -193,6 +203,11 @@ export declare class JsonlSessionStore {
193
203
  readonly description: string;
194
204
  };
195
205
  }[]>;
206
+ executionConfiguration(sessionId: string): Promise<{
207
+ readonly modelId: string;
208
+ readonly modelName?: string;
209
+ readonly reasoningEffort?: string;
210
+ } | undefined>;
196
211
  sessionTree(sessionId: string): Promise<readonly string[]>;
197
212
  delete(sessionId: string): Promise<{
198
213
  readonly deleted: boolean;
@@ -264,7 +264,7 @@ export class JsonlSessionStore {
264
264
  source: normalizeSessionSource(input.source),
265
265
  nextSequence: 1,
266
266
  automaticTitlePending: input.title === undefined,
267
- resume: { version: 1, todoRevision: 0 },
267
+ resume: { version: 1, todoRevision: 0, executionModelIndexed: true },
268
268
  segments: []
269
269
  };
270
270
  const publication = await this.#beginUnpublishedSession(id);
@@ -512,7 +512,7 @@ export class JsonlSessionStore {
512
512
  source: { type: 'user' },
513
513
  nextSequence: 1,
514
514
  automaticTitlePending: false,
515
- resume: { version: 1, todoRevision: 0 },
515
+ resume: { version: 1, todoRevision: 0, executionModelIndexed: true },
516
516
  segments: []
517
517
  };
518
518
  const publication = await this.#beginUnpublishedSession(target.id);
@@ -1166,7 +1166,18 @@ export class JsonlSessionStore {
1166
1166
  workspace: session.workspace,
1167
1167
  createdAt: session.createdAt,
1168
1168
  lastActivityAt: session.lastActivityAt,
1169
- source: normalizeSessionSource(session.source)
1169
+ source: normalizeSessionSource(session.source),
1170
+ ...(session.resume?.modelId === undefined
1171
+ ? {}
1172
+ : {
1173
+ modelId: session.resume.modelId,
1174
+ ...(session.resume.modelName === undefined
1175
+ ? {}
1176
+ : { modelName: session.resume.modelName }),
1177
+ ...(session.resume.reasoningEffort === undefined
1178
+ ? {}
1179
+ : { reasoningEffort: session.resume.reasoningEffort })
1180
+ })
1170
1181
  }));
1171
1182
  const next = start + limit < ordered.length
1172
1183
  ? encodeSessionListCursor(this.#shared.index.revision, start + limit, filter)
@@ -1185,9 +1196,38 @@ export class JsonlSessionStore {
1185
1196
  workspace: session.workspace,
1186
1197
  createdAt: session.createdAt,
1187
1198
  lastActivityAt: session.lastActivityAt,
1188
- source
1199
+ source,
1200
+ ...(session.resume?.modelId === undefined
1201
+ ? {}
1202
+ : {
1203
+ modelId: session.resume.modelId,
1204
+ ...(session.resume.modelName === undefined
1205
+ ? {}
1206
+ : { modelName: session.resume.modelName }),
1207
+ ...(session.resume.reasoningEffort === undefined
1208
+ ? {}
1209
+ : { reasoningEffort: session.resume.reasoningEffort })
1210
+ })
1189
1211
  }));
1190
1212
  }
1213
+ async executionConfiguration(sessionId) {
1214
+ this.#assertOpen();
1215
+ await this.#refreshIndex();
1216
+ const meta = this.#shared.index.sessions.find((session) => session.id === sessionId);
1217
+ if (meta === undefined)
1218
+ throw new MarAgentError('MAR_AGENT_SESSION_NOT_FOUND', 'Session was not found.');
1219
+ if (meta.resume?.executionModelIndexed !== true)
1220
+ await this.#ensureExecutionModelIndexed(meta);
1221
+ return meta.resume?.modelId === undefined
1222
+ ? undefined
1223
+ : {
1224
+ modelId: meta.resume.modelId,
1225
+ ...(meta.resume.modelName === undefined ? {} : { modelName: meta.resume.modelName }),
1226
+ ...(meta.resume.reasoningEffort === undefined
1227
+ ? {}
1228
+ : { reasoningEffort: meta.resume.reasoningEffort })
1229
+ };
1230
+ }
1191
1231
  async sessionTree(sessionId) {
1192
1232
  this.#assertOpen();
1193
1233
  await this.#refreshIndex();
@@ -1201,6 +1241,19 @@ export class JsonlSessionStore {
1201
1241
  const resume = meta.resume;
1202
1242
  if (resume?.version !== 1 || !Number.isSafeInteger(resume.todoRevision))
1203
1243
  return;
1244
+ const executionModel = executionModelFromRecord(record);
1245
+ if (executionModel !== undefined) {
1246
+ resume.executionModelIndexed = true;
1247
+ resume.modelId = executionModel.modelId;
1248
+ if (executionModel.modelName === undefined)
1249
+ delete resume.modelName;
1250
+ else
1251
+ resume.modelName = executionModel.modelName;
1252
+ if (executionModel.reasoningEffort === undefined)
1253
+ delete resume.reasoningEffort;
1254
+ else
1255
+ resume.reasoningEffort = executionModel.reasoningEffort;
1256
+ }
1204
1257
  if (isCompactCheckpoint(record)) {
1205
1258
  resume.compactSequence = record.sequence;
1206
1259
  delete resume.gcSequence;
@@ -1273,6 +1326,24 @@ export class JsonlSessionStore {
1273
1326
  contextRecords: state.contextRecords
1274
1327
  };
1275
1328
  }
1329
+ async #ensureExecutionModelIndexed(meta) {
1330
+ try {
1331
+ await this.#rebuildExecutionState(meta);
1332
+ }
1333
+ catch (error) {
1334
+ if (!(error instanceof MarAgentError) || error.code !== 'MAR_AGENT_SESSION_NOT_FOUND')
1335
+ throw error;
1336
+ const resume = meta.resume;
1337
+ if (resume?.version !== 1 || !Number.isSafeInteger(resume.todoRevision))
1338
+ return;
1339
+ resume.executionModelIndexed = true;
1340
+ delete resume.modelId;
1341
+ delete resume.modelName;
1342
+ delete resume.reasoningEffort;
1343
+ this.#shared.index.revision++;
1344
+ this.#markIndexDirty(meta.id);
1345
+ }
1346
+ }
1276
1347
  async delete(sessionId) {
1277
1348
  this.#assertOpen();
1278
1349
  await this.#refreshIndex();
@@ -1878,6 +1949,7 @@ function deriveExecutionState(records) {
1878
1949
  let todoSequence;
1879
1950
  let todoRevision = 0;
1880
1951
  let todoItems = [];
1952
+ let executionModel;
1881
1953
  for (const record of records) {
1882
1954
  if (record.type === 'session.created')
1883
1955
  automaticTitle =
@@ -1894,6 +1966,9 @@ function deriveExecutionState(records) {
1894
1966
  todoRevision++;
1895
1967
  todoItems = items;
1896
1968
  }
1969
+ const candidate = executionModelFromRecord(record);
1970
+ if (candidate !== undefined)
1971
+ executionModel = candidate;
1897
1972
  }
1898
1973
  const boundary = records.findLastIndex(isCompactCheckpoint);
1899
1974
  const checkpoint = latestValidContextGcCheckpoint(records);
@@ -1912,10 +1987,28 @@ function deriveExecutionState(records) {
1912
1987
  gcBaseSequence: contextGcBaseSequence(checkpoint.payload.base)
1913
1988
  }),
1914
1989
  ...(todoSequence === undefined ? {} : { todoSequence }),
1915
- todoRevision
1990
+ todoRevision,
1991
+ executionModelIndexed: true,
1992
+ ...(executionModel === undefined ? {} : executionModel)
1916
1993
  }
1917
1994
  };
1918
1995
  }
1996
+ function executionModelFromRecord(record) {
1997
+ if (record.type !== 'execution.header' || !isObject(record.payload))
1998
+ return undefined;
1999
+ const modelId = record.payload.modelId;
2000
+ if (typeof modelId !== 'string' || modelId.trim().length === 0)
2001
+ return undefined;
2002
+ const modelName = record.payload.modelName;
2003
+ const reasoningEffort = record.payload.reasoningEffort;
2004
+ return {
2005
+ modelId,
2006
+ ...(typeof modelName === 'string' && modelName.trim().length > 0 ? { modelName } : {}),
2007
+ ...(typeof reasoningEffort === 'string' && reasoningEffort.trim().length > 0
2008
+ ? { reasoningEffort }
2009
+ : {})
2010
+ };
2011
+ }
1919
2012
  export function compactSummaryFromCheckpoint(record) {
1920
2013
  if (record?.type !== 'compact.completed')
1921
2014
  return undefined;
@@ -1950,7 +2043,11 @@ function sameResumeIndex(left, right) {
1950
2043
  left.gcGeneration === right.gcGeneration &&
1951
2044
  left.gcBaseSequence === right.gcBaseSequence &&
1952
2045
  left.todoSequence === right.todoSequence &&
1953
- left.todoRevision === right.todoRevision);
2046
+ left.todoRevision === right.todoRevision &&
2047
+ left.executionModelIndexed === right.executionModelIndexed &&
2048
+ left.modelId === right.modelId &&
2049
+ left.modelName === right.modelName &&
2050
+ left.reasoningEffort === right.reasoningEffort);
1954
2051
  }
1955
2052
  async function readRecords(path) {
1956
2053
  const value = await readFile(path, 'utf8');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myagentroam/agent",
3
- "version": "0.9.131",
3
+ "version": "0.9.133",
4
4
  "description": "Embeddable MAR coding agent SDK and CLI.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",