@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.
- package/dist/agent-core/extensions/session-input.d.ts +2 -0
- package/dist/agent-core/extensions/session-input.js +21 -3
- package/dist/agent-core/runtime/compaction/coordinator.d.ts +15 -0
- package/dist/agent-core/runtime/compaction/coordinator.js +88 -0
- package/dist/agent-core/runtime/compaction/requests.d.ts +16 -0
- package/dist/agent-core/runtime/compaction/requests.js +114 -0
- package/dist/agent-core/runtime/compaction/retained-context.d.ts +6 -0
- package/dist/agent-core/runtime/compaction/retained-context.js +52 -0
- package/dist/agent-core/runtime/context/restore.d.ts +1 -0
- package/dist/agent-core/runtime/context/restore.js +14 -4
- package/dist/agent-core/runtime/context/usage.js +3 -1
- package/dist/agent-core/runtime/event-projection.js +1 -1
- package/dist/agent-core/runtime/events.d.ts +21 -0
- package/dist/agent-core/runtime/execution-policy.d.ts +1 -0
- package/dist/agent-core/runtime/execution-policy.js +1 -0
- package/dist/agent-core/runtime/execution.d.ts +1 -0
- package/dist/agent-core/runtime/execution.js +1 -0
- package/dist/agent-core/sdk/extension-session.js +4 -2
- package/dist/agent-core/sdk/session.d.ts +2 -0
- package/dist/agent-core/sdk/session.js +307 -191
- package/dist/agent-core/sdk/types.d.ts +4 -1
- package/dist/agent-core/session/catalog.js +2 -2
- package/dist/agent-core/session/jsonl-store.d.ts +2 -0
- package/dist/agent-core/session/jsonl-store.js +6 -0
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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?:
|
|
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';
|