newmark-agent 0.3.8 → 0.3.11

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.
Files changed (36) hide show
  1. package/dist/cli-help.d.ts +2 -0
  2. package/dist/cli-help.js +22 -0
  3. package/dist/context/domain/types.d.ts +1 -1
  4. package/dist/conversation-utility-host.bundle.cjs +2060 -774
  5. package/dist/conversation-utility-host.js +4 -1
  6. package/dist/core/agent.d.ts +23 -1
  7. package/dist/core/agent.js +517 -37
  8. package/dist/core/agentKernelRunner.js +20 -3
  9. package/dist/core/browserControl.d.ts +8 -0
  10. package/dist/core/browserUsePageAdapter.d.ts +3 -0
  11. package/dist/core/browserUsePageAdapter.js +19 -2
  12. package/dist/core/compressionHistoryArchive.d.ts +28 -0
  13. package/dist/core/compressionHistoryArchive.js +131 -0
  14. package/dist/core/computerUseSession.d.ts +44 -0
  15. package/dist/core/computerUseSession.js +105 -0
  16. package/dist/core/config.js +1 -0
  17. package/dist/core/conversationKernel.d.ts +3 -1
  18. package/dist/core/conversationKernel.js +76 -7
  19. package/dist/core/electronBrowserUseHost.js +16 -0
  20. package/dist/core/electronUtilityAgentClient.js +84 -2
  21. package/dist/core/electronUtilityRuntimePool.js +6 -7
  22. package/dist/core/runtimeLifecycle.d.ts +23 -0
  23. package/dist/core/runtimeLifecycle.js +146 -0
  24. package/dist/core/types.d.ts +3 -0
  25. package/dist/core/utilityHostToolRouter.d.ts +7 -0
  26. package/dist/core/utilityHostToolRouter.js +25 -33
  27. package/dist/core/wslAgentRuntimePool.js +9 -10
  28. package/dist/launcher.js +13 -1
  29. package/dist/main.js +147 -18
  30. package/dist/preload.js +4 -2
  31. package/dist/tools/index.js +42 -52
  32. package/dist/tools/nativeTools.js +1 -1
  33. package/dist/ui/index.html +296 -40
  34. package/dist/wsl-agent-host.bundle.cjs +2063 -776
  35. package/dist/wsl-agent-host.js +4 -0
  36. package/package.json +3 -3
@@ -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
  }
@@ -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;
@@ -298,6 +300,7 @@ export declare class Agent {
298
300
  } | null;
299
301
  private compressionCache;
300
302
  private nextCompressionCacheId;
303
+ private readonly compressionHistoryArchive;
301
304
  private workspaceConversations;
302
305
  isSubagentRuntime: boolean;
303
306
  private subagentName;
@@ -351,8 +354,10 @@ export declare class Agent {
351
354
  private readonly rootInboxListener;
352
355
  readonly agentOnly: boolean;
353
356
  readonly runtimeActorId: string;
357
+ readonly runtimeLifecycleRole: RuntimeLifecycleRole;
354
358
  /** dev-0.3.0 context system facade (feature-flagged, default off). */
355
359
  readonly contextV2: AgentContextManager;
360
+ private readonly runtimeLifecycle;
356
361
  /** dev-0.3.0 toolchain core (registry + capability catalog). Seeded lazily from cachedToolDefinitions; not consumed by the legacy path. */
357
362
  private toolchainCore;
358
363
  /**
@@ -462,7 +467,15 @@ export declare class Agent {
462
467
  private conversationEntryForDisk;
463
468
  private normalizeWorkRuns;
464
469
  private recoverPersistedWorkRuns;
470
+ private pauseFlowAfterUnexpectedExit;
465
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;
466
479
  private createAgentRunForWorkRun;
467
480
  private syncAgentRunTerminal;
468
481
  private syncAgentRunFromEvent;
@@ -579,6 +592,7 @@ export declare class Agent {
579
592
  sanitizeAssistantStreamingOutput(text: string): string;
580
593
  sanitizeAssistantOutput(text: string): string;
581
594
  sanitizeVisibleTokens(tokens: StreamToken[]): StreamToken[];
595
+ private activeConversationRuntimeOwner;
582
596
  saveWorkspaceConversationState(flush?: boolean): void;
583
597
  private loadWorkspaceConversationState;
584
598
  private applyWorkspaceContext;
@@ -664,12 +678,16 @@ export declare class Agent {
664
678
  private postCompressionContinuationMessage;
665
679
  updateGoal(newGoal: string): void;
666
680
  toggleGoalPause(): boolean;
681
+ /** Pause only in response to the user's explicit Stop action. */
682
+ pauseGoalForUserInterrupt(): boolean;
667
683
  clearGoal(): void;
668
684
  markGoalComplete(): void;
669
685
  isGoalPaused(): boolean;
670
686
  setGoalContinuationGate(gate: (() => boolean) | null): void;
671
687
  canAutoContinueGoal(): boolean;
672
- claimGoalContinuationMessage(): AgentPromptMessage | null;
688
+ claimGoalContinuationMessage(options?: {
689
+ force?: boolean;
690
+ }): AgentPromptMessage | null;
673
691
  private writeSessionArchive;
674
692
  archiveSession(): string;
675
693
  archiveConversation(conversationId: string): string | null;
@@ -815,6 +833,10 @@ export declare class Agent {
815
833
  private compactSummaryBody;
816
834
  private formatCompressionSummary;
817
835
  private persistCompressedHistory;
836
+ private compressionArchiveScopeKey;
837
+ private coldCompressionEntries;
838
+ private archiveColdCompressionEntries;
839
+ private markColdCompressionRestored;
818
840
  private pushCompressionCacheEntry;
819
841
  private contextHistoryProtectedStartIndex;
820
842
  private contextHistoryProtectedZone;