@myagentroam/agent 0.10.29 → 0.10.30

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.
@@ -21,12 +21,15 @@ export interface ExecutionHandle extends AsyncIterable<MarAgentEvent> {
21
21
  /** Signals abort; await result() to observe the terminal status and cleanup. */
22
22
  cancel(): void;
23
23
  }
24
+ export type CompactInput = Partial<RunInput> & {
25
+ readonly async?: boolean;
26
+ };
24
27
  /** A persisted Session permits one active main execution at a time. */
25
28
  export interface MarAgentSession {
26
29
  readonly id: string;
27
30
  run(input: RunInput): ExecutionHandle;
28
31
  plan(input: RunInput): ExecutionHandle;
29
- compact(input?: Partial<RunInput>): ExecutionHandle;
32
+ compact(input?: CompactInput): ExecutionHandle;
30
33
  cancel(executionId: string): Promise<void>;
31
34
  }
32
35
  export interface MarAgent {
@@ -86,8 +86,8 @@ export async function openMarAgentSessionCatalog(input) {
86
86
  if (!isMarAgentEvent(record.payload))
87
87
  continue;
88
88
  if (record.payload.type === 'context.compacted')
89
- return { inputTokens: 0 };
90
- if (record.payload.type === 'usage.updated') {
89
+ return record.payload.retainedContext === true ? undefined : { inputTokens: 0 };
90
+ if (record.payload.type === 'usage.updated' && record.payload.purpose !== 'compact') {
91
91
  const inputTokens = record.payload.contextInputTokens ?? record.payload.inputTokens;
92
92
  if (typeof inputTokens === 'number' &&
93
93
  Number.isSafeInteger(inputTokens) &&
@@ -193,6 +193,8 @@ export declare class JsonlSessionStore {
193
193
  summary: string;
194
194
  replacementHistory?: readonly CompactHistoryMessage[];
195
195
  retainedModelContext?: readonly ModelMessage[];
196
+ snapshotRecordId?: string;
197
+ snapshotMessageCount?: number;
196
198
  environment?: EnvironmentContextState;
197
199
  automatic?: boolean;
198
200
  modelId?: string;
@@ -1306,6 +1306,12 @@ export class JsonlSessionStore {
1306
1306
  type: 'compact.completed',
1307
1307
  payload: {
1308
1308
  summary: input.summary,
1309
+ ...(input.snapshotRecordId === undefined
1310
+ ? {}
1311
+ : { snapshotRecordId: input.snapshotRecordId }),
1312
+ ...(input.snapshotMessageCount === undefined
1313
+ ? {}
1314
+ : { snapshotMessageCount: input.snapshotMessageCount }),
1309
1315
  ...(input.replacementHistory === undefined
1310
1316
  ? {}
1311
1317
  : { replacementHistory: input.replacementHistory }),
package/dist/index.d.ts CHANGED
@@ -38,7 +38,7 @@ export type { CoreModelsApi, CoreModelDescription, CoreModelTextBlock, CoreGener
38
38
  export type { CoreDataApi, CoreJsonValue, CoreCheckpoint, CoreCheckpointApi, CoreStateApi, CoreStateChange, CoreStoreApi, CoreStoreCommit } from './agent-core/extensions/data.js';
39
39
  export { generateSessionTitle, type GenerateSessionTitleInput } from './shared/auto-title.js';
40
40
  export type { CoreProcessesApi, CoreProcessesBackend, CoreProcessInput, CoreProcessRunInput, CoreProcessHandle, CoreProcessExit, CoreProcessResult, CoreProcessCompletion } from './agent-core/extensions/processes.js';
41
- export type { CreateMarAgentOptions, CreateSessionInput, ExecutionHandle, MarAgent, MarAgentSession, SessionTitleUpdateInput } from './agent-core/sdk/types.js';
41
+ export type { CreateMarAgentOptions, CreateSessionInput, ExecutionHandle, CompactInput, MarAgent, MarAgentSession, SessionTitleUpdateInput } from './agent-core/sdk/types.js';
42
42
  export { openMarAgentSessionCatalog, type MarAgentContextUsage, type MarAgentHistoryEntry, type MarAgentHistoryPage, type MarAgentSessionCatalog, type MarAgentSessionDeleteResult, type MarAgentSessionImage, type MarAgentSessionPage, type MarAgentSessionSummary } from './agent-core/session/catalog.js';
43
43
  export type { SessionListInput, SessionSource } from './agent-core/session/types.js';
44
44
  export type { ApplyPatchFileResult, ApplyPatchResult, ApplyPatchPartialResult, ClientToolDefinition, MarAgentToolArtifact, MarAgentToolImageArtifact, McpCatalogTool, McpToolCallContext, McpToolCatalog, McpToolCatalogContext, ToolCall, ToolCaller, ToolExecutionContext, ToolExecutionResult } from './agent-core/tools/contracts.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myagentroam/agent",
3
- "version": "0.10.29",
3
+ "version": "0.10.30",
4
4
  "description": "Embeddable MAR coding agent SDK and CLI.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",