newmark-agent 0.6.3 → 0.6.7

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 (72) hide show
  1. package/config.example.json +13 -3
  2. package/dist/cli-commands.d.ts +1 -1
  3. package/dist/cli-commands.js +53 -2
  4. package/dist/cli-discovery.js +3 -0
  5. package/dist/conversation-utility-host.bundle.cjs +3046 -1038
  6. package/dist/conversation-utility-host.js +94 -7
  7. package/dist/core/agent.d.ts +149 -12
  8. package/dist/core/agent.js +843 -176
  9. package/dist/core/agentKernelRunner.d.ts +7 -1
  10. package/dist/core/agentKernelRunner.js +171 -22
  11. package/dist/core/autoRouter.d.ts +49 -44
  12. package/dist/core/autoRouter.js +117 -302
  13. package/dist/core/branchIdentity.d.ts +29 -0
  14. package/dist/core/branchIdentity.js +54 -0
  15. package/dist/core/config.js +27 -11
  16. package/dist/core/continuation/contracts.d.ts +1 -1
  17. package/dist/core/continuation/store.d.ts +119 -1
  18. package/dist/core/continuation/store.js +337 -19
  19. package/dist/core/conversationKernel.d.ts +62 -8
  20. package/dist/core/conversationKernel.js +361 -47
  21. package/dist/core/conversationStateDocument.d.ts +18 -0
  22. package/dist/core/conversationStateDocument.js +88 -0
  23. package/dist/core/conversationVisualBudget.d.ts +74 -0
  24. package/dist/core/conversationVisualBudget.js +153 -0
  25. package/dist/core/electronUtilityAgentClient.d.ts +3 -2
  26. package/dist/core/electronUtilityAgentClient.js +32 -8
  27. package/dist/core/electronUtilityRuntimePool.d.ts +28 -3
  28. package/dist/core/electronUtilityRuntimePool.js +93 -24
  29. package/dist/core/hostRuntimeHooks.d.ts +23 -0
  30. package/dist/core/hostRuntimeHooks.js +17 -0
  31. package/dist/core/jevDecision.d.ts +144 -0
  32. package/dist/core/jevDecision.js +226 -0
  33. package/dist/core/memoryProbe.d.ts +24 -0
  34. package/dist/core/memoryProbe.js +104 -0
  35. package/dist/core/mobilePairing.d.ts +7 -1
  36. package/dist/core/mobilePairing.js +9 -1
  37. package/dist/core/performanceDiagnostics.d.ts +1 -1
  38. package/dist/core/routeDecisionValidator.d.ts +86 -0
  39. package/dist/core/routeDecisionValidator.js +249 -0
  40. package/dist/core/routeEligibility.d.ts +52 -0
  41. package/dist/core/routeEligibility.js +108 -0
  42. package/dist/core/runtimeMemoryBudget.d.ts +6 -0
  43. package/dist/core/runtimeMemoryBudget.js +12 -0
  44. package/dist/core/utilityAgentProtocol.d.ts +8 -10
  45. package/dist/core/utilityHostToolRouter.js +2 -0
  46. package/dist/core/visualDownscale.d.ts +6 -0
  47. package/dist/core/visualDownscale.js +137 -0
  48. package/dist/core/wslAgentClient.d.ts +1 -2
  49. package/dist/core/wslAgentClient.js +0 -8
  50. package/dist/core/wslAgentProtocol.d.ts +1 -10
  51. package/dist/core/wslAgentRuntimePool.d.ts +1 -3
  52. package/dist/core/wslAgentRuntimePool.js +17 -22
  53. package/dist/llm/provider.d.ts +3 -1
  54. package/dist/llm/provider.js +53 -9
  55. package/dist/main.js +108 -31
  56. package/dist/preload.js +3 -1
  57. package/dist/server.js +30 -18
  58. package/dist/tools/computerUse.d.ts +4 -0
  59. package/dist/tools/computerUse.js +202 -4
  60. package/dist/tools/computerUsePowerShellHost.d.ts +6 -1
  61. package/dist/tools/computerUsePowerShellHost.js +105 -31
  62. package/dist/tools/index.js +4 -1
  63. package/dist/tui/src/adapters/core-runtime-adapter.js +13 -1
  64. package/dist/tui/src/i18n.js +12 -1
  65. package/dist/tui/src/render.js +9 -2
  66. package/dist/tui/src/settings-schema.js +19 -0
  67. package/dist/tui/src/state.js +69 -1
  68. package/dist/ui/index.html +994 -277
  69. package/dist/ui/lucide-sprite.svg +0 -8
  70. package/dist/wsl-agent-host.bundle.cjs +2851 -1013
  71. package/dist/wsl-agent-host.js +0 -3
  72. package/package.json +38 -9
@@ -1,4 +1,4 @@
1
- import { Agent, AutoRouteRatingResult } from './agent';
1
+ import { Agent } from './agent';
2
2
  import { AgentMode, AgentWorkEvent, ConversationInputEnvelope, ConversationImageAttachment, GuideReceipt, OptionQuestion } from './types';
3
3
  import { AutomationManager } from './automation';
4
4
  import { ConversationRuntimeTarget, NormalizedConversationTarget } from './conversationTarget';
@@ -19,8 +19,12 @@ export interface ConversationQueueItemSnapshot {
19
19
  /** Exact workspace ledger branch id used when this row was admitted. */
20
20
  ledgerBranchId?: string;
21
21
  modelSelection?: string;
22
+ /** Ledger reason shown when a queued row cannot run (for example DEPENDENCY_FAILED). */
23
+ waitingReason?: string;
24
+ /** True when the ledger currently blocks this row from being claimed. */
25
+ blocked?: boolean;
22
26
  }
23
- export type ConversationQueueAction = 'enqueue' | 'update' | 'delete' | 'reorder' | 'toggle_pause' | 'set_pause' | 'guide';
27
+ export type ConversationQueueAction = 'enqueue' | 'update' | 'delete' | 'reorder' | 'toggle_pause' | 'set_pause' | 'repair_blocked' | 'guide';
24
28
  export interface ConversationQueueActionInput {
25
29
  id?: string;
26
30
  text?: string;
@@ -87,8 +91,7 @@ export interface AgentPromptMessage {
87
91
  attachments?: ConversationImageAttachment[];
88
92
  }>;
89
93
  routePolicy?: {
90
- mode?: 'quality' | 'balanced' | 'cost' | 'speed';
91
- maxQualityLoss?: number;
94
+ mode?: 'conservative' | 'balanced' | 'aggressive';
92
95
  maxExpectedCostUsd?: number;
93
96
  allowPreview?: boolean;
94
97
  privacy?: 'default' | 'no_training' | 'zdr';
@@ -156,7 +159,6 @@ export interface ConversationKernelRunResult {
156
159
  workRuns: Agent['workRuns'];
157
160
  routeDecision?: Agent['lastRouteDecision'];
158
161
  resolvedDeployment?: ReturnType<Agent['activeDeployment']>;
159
- autoRouteRatingAvailable?: boolean;
160
162
  }
161
163
  export type ConversationTargetInput = string | ConversationRuntimeTarget;
162
164
  export interface ConversationRuntimeState {
@@ -216,6 +218,32 @@ export declare class ConversationKernel {
216
218
  private listeners;
217
219
  private readonly eventLimit;
218
220
  private generations;
221
+ /**
222
+ * Durable continuation ledgers are read on every queue projection and state
223
+ * snapshot. Building a fresh store each time re-parsed (and previously also
224
+ * re-wrote) the whole JSON ledger, so a long conversation became slower with
225
+ * every turn. The store revalidates its cache through the ledger file
226
+ * fingerprint on each read, so one instance per branch stays authoritative.
227
+ */
228
+ private readonly continuationStores;
229
+ /** Throttles orphan sweeps per branch so snapshots stay read-only and cheap. */
230
+ private readonly orphanSweepAt;
231
+ /**
232
+ * dev-0.6.6: is the process that owns an attempt still alive?
233
+ *
234
+ * Attempts record their owner as `kernel:<pid>`. A dead owner can never write
235
+ * a terminal state, so its build/guard must be reclaimed by a live reader
236
+ * instead of waiting for a claim that nobody will ever make.
237
+ */
238
+ private workerCapabilityAlive;
239
+ /**
240
+ * Reclaim an orphaned queued turn (dead owner / long-expired lease) and, when
241
+ * the conversation is idle and its queue is not paused, let the queue run
242
+ * again. Field evidence: a utility host died of V8 OOM mid-turn and left the
243
+ * build RUNNING with an expired guard, so every later queued row entered the
244
+ * panel but never executed.
245
+ */
246
+ private maybeRecoverOrphanedAttempt;
219
247
  constructor(root: string, host: Agent, automation: AutomationManager | null, lifecycle?: ConversationKernelLifecycle);
220
248
  subscribe(listener: WorkListener): () => void;
221
249
  isRunning(target: ConversationTargetInput): boolean;
@@ -252,7 +280,27 @@ export declare class ConversationKernel {
252
280
  }): string | null;
253
281
  settleExternalRun(target: ConversationTargetInput, completed: boolean): void;
254
282
  releaseExternalRun(target: ConversationTargetInput, paused: boolean): void;
255
- prepareForArchive(target: ConversationTargetInput): Promise<Agent | null>;
283
+ /**
284
+ * Start an archive for one conversation.
285
+ *
286
+ * An archive has to wait for the conversation's own run to settle before the
287
+ * writer takes its payload snapshot and deletes the state entry: a run that
288
+ * is still writing would otherwise append to a conversation that no longer
289
+ * exists (silently losing the tail), and its trailing state flush would
290
+ * resurrect the archived entry. That wait is not a budget to be truncated —
291
+ * it is real work, and the way to end it is to *release the occupancy* the
292
+ * run is holding, not to give up on it.
293
+ *
294
+ * So the caller passes the hard stop of the resident runtime as
295
+ * `releaseOccupancy`. It runs concurrently with the settle below: the hard
296
+ * stop invalidates the in-flight request (the client rejects every pending
297
+ * request of the evicted generation), which is exactly what makes a wedged
298
+ * run finish. Both teardown paths therefore overlap instead of serializing,
299
+ * and no timer exists to mask a runtime that refuses to end.
300
+ */
301
+ prepareForArchive(target: ConversationTargetInput, options?: {
302
+ releaseOccupancy?: () => Promise<void> | void;
303
+ }): Promise<Agent | null>;
256
304
  finishArchive(target: ConversationTargetInput, completed: boolean, preserveOwner?: boolean): void;
257
305
  isAnyRunning(): boolean;
258
306
  hasRetainedWork(): boolean;
@@ -303,6 +351,14 @@ export declare class ConversationKernel {
303
351
  deleteQueueItem(target: ConversationTargetInput, idInput: string): boolean;
304
352
  reorderQueueItems(target: ConversationTargetInput, orderedIdsInput: string[]): ConversationQueueItemSnapshot[];
305
353
  setQueuePaused(target: ConversationTargetInput, paused: boolean): boolean;
354
+ /**
355
+ * dev-0.6.4 hotfix: 显式修复被失败前置阻断的排队行。
356
+ *
357
+ * 0.6.3 的合约是「失败/取消阻断后继,且不静默跳过」,所以这里不挂在恢复动作上
358
+ * 自动执行;它必须由用户的显式动作触发(界面上的“修复受阻队列”按钮)。每一次
359
+ * 改挂都写入 `BuildQueueRepaired` 事件并发布可见状态,触发者与原因可审计。
360
+ */
361
+ private repairBlockedQueueNow;
306
362
  queueAction(target: ConversationTargetInput, action: ConversationQueueAction, input?: ConversationQueueActionInput): {
307
363
  ok: boolean;
308
364
  queueItems: ConversationQueueItemSnapshot[];
@@ -345,7 +401,6 @@ export declare class ConversationKernel {
345
401
  conversationLocked: false;
346
402
  routeDecision: Agent['lastRouteDecision'];
347
403
  resolvedDeployment: ReturnType<Agent['activeDeployment']>;
348
- autoRouteRatingAvailable: boolean;
349
404
  };
350
405
  runtimeStates(): ConversationRuntimeState[];
351
406
  enqueueGuide(envelope: ConversationInputEnvelope): GuideReceipt;
@@ -357,7 +412,6 @@ export declare class ConversationKernel {
357
412
  at: string;
358
413
  };
359
414
  compressContext(target: ConversationTargetInput, options?: ConversationContextCompressOptions): Promise<Record<string, unknown>>;
360
- rateAutoRoute(target: ConversationTargetInput, score: number, expectedRouteId?: string): AutoRouteRatingResult;
361
415
  setWorkRunExpanded(target: ConversationTargetInput, runId: string, expanded: boolean): boolean;
362
416
  setInputMode(target: ConversationTargetInput, mode: string): 'guide' | 'next';
363
417
  setMode(target: ConversationTargetInput, mode: AgentMode): AgentMode;