newmark-agent 0.3.7 → 0.3.10
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/context/domain/types.d.ts +1 -1
- package/dist/conversation-utility-host.bundle.cjs +2048 -716
- package/dist/conversation-utility-host.js +4 -1
- package/dist/core/agent.d.ts +39 -1
- package/dist/core/agent.js +681 -28
- package/dist/core/agentKernelRunner.js +1 -1
- package/dist/core/compressionHistoryArchive.d.ts +28 -0
- package/dist/core/compressionHistoryArchive.js +131 -0
- package/dist/core/config.js +3 -0
- package/dist/core/conversationKernel.d.ts +2 -1
- package/dist/core/conversationKernel.js +38 -7
- package/dist/core/electronBrowserUseHost.js +9 -0
- package/dist/core/electronUtilityRuntimePool.js +6 -7
- package/dist/core/runtimeLifecycle.d.ts +23 -0
- package/dist/core/runtimeLifecycle.js +146 -0
- package/dist/core/types.d.ts +3 -0
- package/dist/core/wslAgentRuntimePool.js +9 -10
- package/dist/main.js +15 -0
- package/dist/tools/index.js +9 -3
- package/dist/tools/nativeTools.js +1 -1
- package/dist/ui/index.html +14 -4
- package/dist/wsl-agent-host.bundle.cjs +2051 -718
- package/dist/wsl-agent-host.js +4 -0
- package/package.json +2 -2
|
@@ -6,6 +6,7 @@ const conversationKernel_1 = require("./core/conversationKernel");
|
|
|
6
6
|
const conversationTarget_1 = require("./core/conversationTarget");
|
|
7
7
|
const utilityHostToolBridge_1 = require("./core/utilityHostToolBridge");
|
|
8
8
|
const terminalTakeover_1 = require("./tools/terminalTakeover");
|
|
9
|
+
const runtimeLifecycle_1 = require("./core/runtimeLifecycle");
|
|
9
10
|
const root = String(process.env.NEWMARK_RUNTIME_ROOT || '');
|
|
10
11
|
const expectedRuntimeKey = String(process.env.NEWMARK_RUNTIME_KEY || '');
|
|
11
12
|
if (!root)
|
|
@@ -15,7 +16,7 @@ if (!expectedRuntimeKey)
|
|
|
15
16
|
const parentPort = process.parentPort;
|
|
16
17
|
if (!parentPort)
|
|
17
18
|
throw new Error('Electron utility parentPort is unavailable');
|
|
18
|
-
const host = new agent_1.Agent(root);
|
|
19
|
+
const host = new agent_1.Agent(root, { runtimeLifecycleRole: 'utility' });
|
|
19
20
|
host.tools.setHostProfile({
|
|
20
21
|
kind: 'electron-utility',
|
|
21
22
|
platform: process.platform,
|
|
@@ -51,6 +52,8 @@ async function handle(request) {
|
|
|
51
52
|
return { backend: 'utility', pid: process.pid, runtimeKey: expectedRuntimeKey };
|
|
52
53
|
if (request.method === 'shutdown') {
|
|
53
54
|
(0, terminalTakeover_1.shutdownTerminalTakeoverSessions)('utility-runtime-shutdown');
|
|
55
|
+
if (!host.goal || host.goal.paused)
|
|
56
|
+
(0, runtimeLifecycle_1.markRuntimeLifecycleClean)(root, 'utility');
|
|
54
57
|
setTimeout(() => process.exit(0), 10);
|
|
55
58
|
return true;
|
|
56
59
|
}
|
package/dist/core/agent.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { DeploymentRef, ModelSelection, PlannedRouteAttempt, RouteDecision } fro
|
|
|
15
15
|
import { AgentContextManager } from '../context/services/agent-context-manager';
|
|
16
16
|
import type { AssembledContext } from '../context/services/context-orchestrator';
|
|
17
17
|
import { type ToolchainCore } from '../toolchain';
|
|
18
|
+
import { type RuntimeLifecycleRole } from './runtimeLifecycle';
|
|
18
19
|
export { AgentMode, InputMode, AgentStatus, StreamToken, ChatMessage, GoalState, GoalItem, OptionQuestion, FileDiff, AgentWorkEvent, ConversationTarget, ConversationWorkRun, GuideReceipt, ConversationImageAttachment, DisplayImageAttachment };
|
|
19
20
|
export interface ModelValidationResult extends ModelEvaluation {
|
|
20
21
|
name: string;
|
|
@@ -31,6 +32,7 @@ export interface AgentRuntimeOptions {
|
|
|
31
32
|
workspaceRegistryMode?: 'managed' | 'detached';
|
|
32
33
|
actorId?: string;
|
|
33
34
|
conversationId?: string;
|
|
35
|
+
runtimeLifecycleRole?: RuntimeLifecycleRole;
|
|
34
36
|
linkedPlanAccess?: {
|
|
35
37
|
get(conversationId?: string): LinkedPlanState;
|
|
36
38
|
update(markdown: string, expectedRevision: number, actorId: string, conversationId?: string): LinkedPlanState;
|
|
@@ -58,6 +60,16 @@ export interface AutoRouteRatingResult {
|
|
|
58
60
|
}
|
|
59
61
|
export declare const ROOT_AGENT_ACTOR_ID = "00000000-0000-4000-8000-000000000001";
|
|
60
62
|
export declare function normalizeIntelligenceTier(value: unknown): 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'ultra';
|
|
63
|
+
export interface CompressionCacheEntry {
|
|
64
|
+
id: string;
|
|
65
|
+
at: string;
|
|
66
|
+
summary: string;
|
|
67
|
+
messages: Array<Record<string, unknown>>;
|
|
68
|
+
foldedEntries: number;
|
|
69
|
+
foldedChars: number;
|
|
70
|
+
model: string;
|
|
71
|
+
fallback: boolean;
|
|
72
|
+
}
|
|
61
73
|
type ConversationModelSelection = {
|
|
62
74
|
kind: 'auto';
|
|
63
75
|
} | {
|
|
@@ -286,6 +298,9 @@ export declare class Agent {
|
|
|
286
298
|
model: string;
|
|
287
299
|
fallback: boolean;
|
|
288
300
|
} | null;
|
|
301
|
+
private compressionCache;
|
|
302
|
+
private nextCompressionCacheId;
|
|
303
|
+
private readonly compressionHistoryArchive;
|
|
289
304
|
private workspaceConversations;
|
|
290
305
|
isSubagentRuntime: boolean;
|
|
291
306
|
private subagentName;
|
|
@@ -339,8 +354,10 @@ export declare class Agent {
|
|
|
339
354
|
private readonly rootInboxListener;
|
|
340
355
|
readonly agentOnly: boolean;
|
|
341
356
|
readonly runtimeActorId: string;
|
|
357
|
+
readonly runtimeLifecycleRole: RuntimeLifecycleRole;
|
|
342
358
|
/** dev-0.3.0 context system facade (feature-flagged, default off). */
|
|
343
359
|
readonly contextV2: AgentContextManager;
|
|
360
|
+
private readonly runtimeLifecycle;
|
|
344
361
|
/** dev-0.3.0 toolchain core (registry + capability catalog). Seeded lazily from cachedToolDefinitions; not consumed by the legacy path. */
|
|
345
362
|
private toolchainCore;
|
|
346
363
|
/**
|
|
@@ -450,7 +467,15 @@ export declare class Agent {
|
|
|
450
467
|
private conversationEntryForDisk;
|
|
451
468
|
private normalizeWorkRuns;
|
|
452
469
|
private recoverPersistedWorkRuns;
|
|
470
|
+
private pauseFlowAfterUnexpectedExit;
|
|
453
471
|
beginConversationWorkRun(runId: string, target?: ConversationTarget, startedAt?: string, managed?: boolean, runtimeKey?: string): ConversationWorkRun;
|
|
472
|
+
private buildHistoryStatus;
|
|
473
|
+
private ensureBuildHistoryBlock;
|
|
474
|
+
private finalWorkRunSummary;
|
|
475
|
+
private auditGoalAtWorkRunEnd;
|
|
476
|
+
private enforceGoalTerminalInvariant;
|
|
477
|
+
private persistBuildBlockWorkOverview;
|
|
478
|
+
private recoverMissingTerminalBuildOverviews;
|
|
454
479
|
private createAgentRunForWorkRun;
|
|
455
480
|
private syncAgentRunTerminal;
|
|
456
481
|
private syncAgentRunFromEvent;
|
|
@@ -567,6 +592,7 @@ export declare class Agent {
|
|
|
567
592
|
sanitizeAssistantStreamingOutput(text: string): string;
|
|
568
593
|
sanitizeAssistantOutput(text: string): string;
|
|
569
594
|
sanitizeVisibleTokens(tokens: StreamToken[]): StreamToken[];
|
|
595
|
+
private activeConversationRuntimeOwner;
|
|
570
596
|
saveWorkspaceConversationState(flush?: boolean): void;
|
|
571
597
|
private loadWorkspaceConversationState;
|
|
572
598
|
private applyWorkspaceContext;
|
|
@@ -652,12 +678,16 @@ export declare class Agent {
|
|
|
652
678
|
private postCompressionContinuationMessage;
|
|
653
679
|
updateGoal(newGoal: string): void;
|
|
654
680
|
toggleGoalPause(): boolean;
|
|
681
|
+
/** Pause only in response to the user's explicit Stop action. */
|
|
682
|
+
pauseGoalForUserInterrupt(): boolean;
|
|
655
683
|
clearGoal(): void;
|
|
656
684
|
markGoalComplete(): void;
|
|
657
685
|
isGoalPaused(): boolean;
|
|
658
686
|
setGoalContinuationGate(gate: (() => boolean) | null): void;
|
|
659
687
|
canAutoContinueGoal(): boolean;
|
|
660
|
-
claimGoalContinuationMessage(
|
|
688
|
+
claimGoalContinuationMessage(options?: {
|
|
689
|
+
force?: boolean;
|
|
690
|
+
}): AgentPromptMessage | null;
|
|
661
691
|
private writeSessionArchive;
|
|
662
692
|
archiveSession(): string;
|
|
663
693
|
archiveConversation(conversationId: string): string | null;
|
|
@@ -803,6 +833,14 @@ export declare class Agent {
|
|
|
803
833
|
private compactSummaryBody;
|
|
804
834
|
private formatCompressionSummary;
|
|
805
835
|
private persistCompressedHistory;
|
|
836
|
+
private compressionArchiveScopeKey;
|
|
837
|
+
private coldCompressionEntries;
|
|
838
|
+
private archiveColdCompressionEntries;
|
|
839
|
+
private markColdCompressionRestored;
|
|
840
|
+
private pushCompressionCacheEntry;
|
|
841
|
+
private contextHistoryProtectedStartIndex;
|
|
842
|
+
private contextHistoryProtectedZone;
|
|
843
|
+
private snippetAround;
|
|
806
844
|
buildSystemPrompt(): string;
|
|
807
845
|
/**
|
|
808
846
|
* dev-0.3.0: assemble the model-request system prompt through the Context
|