newmark-agent 0.3.10 → 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.
- package/dist/cli-help.d.ts +2 -0
- package/dist/cli-help.js +22 -0
- package/dist/conversation-utility-host.bundle.cjs +191 -53
- package/dist/core/agent.js +22 -4
- package/dist/core/agentKernelRunner.js +19 -2
- package/dist/core/browserControl.d.ts +8 -0
- package/dist/core/browserUsePageAdapter.d.ts +3 -0
- package/dist/core/browserUsePageAdapter.js +19 -2
- package/dist/core/computerUseSession.d.ts +44 -0
- package/dist/core/computerUseSession.js +105 -0
- package/dist/core/conversationKernel.d.ts +1 -0
- package/dist/core/conversationKernel.js +38 -0
- package/dist/core/electronBrowserUseHost.js +7 -0
- package/dist/core/electronUtilityAgentClient.js +84 -2
- package/dist/core/utilityHostToolRouter.d.ts +7 -0
- package/dist/core/utilityHostToolRouter.js +25 -33
- package/dist/launcher.js +13 -1
- package/dist/main.js +132 -18
- package/dist/preload.js +4 -2
- package/dist/tools/index.js +36 -49
- package/dist/ui/index.html +296 -39
- package/dist/wsl-agent-host.bundle.cjs +191 -53
- package/package.json +2 -2
|
@@ -335773,10 +335773,102 @@ function browserVisualFallback(runtimeKey, observationId) {
|
|
|
335773
335773
|
return browserFallbacks.get(key(runtimeKey, observationId)) || null;
|
|
335774
335774
|
}
|
|
335775
335775
|
|
|
335776
|
+
// src/core/computerUseSession.ts
|
|
335777
|
+
var COMPUTER_USE_OCCUPIED_MARKER = "computerUse occupied";
|
|
335778
|
+
var COMPUTER_USE_LOCK_TTL_MS = 10 * 60 * 1e3;
|
|
335779
|
+
var ComputerUseSessionRegistry = class {
|
|
335780
|
+
constructor(ttlMs = COMPUTER_USE_LOCK_TTL_MS) {
|
|
335781
|
+
this.ttlMs = ttlMs;
|
|
335782
|
+
}
|
|
335783
|
+
ttlMs;
|
|
335784
|
+
enabledByRuntime = /* @__PURE__ */ new Map();
|
|
335785
|
+
activeLease = null;
|
|
335786
|
+
authorize(action, scope, dryRun = false) {
|
|
335787
|
+
const normalizedAction = String(action || "").trim().toLowerCase();
|
|
335788
|
+
const runtimeKey = String(scope.runtimeKey || "").trim() || "conversation:default";
|
|
335789
|
+
const now2 = Date.now();
|
|
335790
|
+
this.clearExpired(now2);
|
|
335791
|
+
if (this.activeLease && this.activeLease.runtimeKey !== runtimeKey) {
|
|
335792
|
+
return this.occupiedError(normalizedAction, scope.ownerLabel, this.activeLease.ownerLabel);
|
|
335793
|
+
}
|
|
335794
|
+
if (normalizedAction === "takeover_stop") return null;
|
|
335795
|
+
const enabled = this.enabledByRuntime.get(runtimeKey) !== false;
|
|
335796
|
+
const readOnly = normalizedAction === "observe" || normalizedAction === "app_list" || normalizedAction === "app_observe" || normalizedAction === "wait";
|
|
335797
|
+
if (!enabled && !readOnly && !dryRun && normalizedAction !== "takeover_start") {
|
|
335798
|
+
return JSON.stringify({
|
|
335799
|
+
ok: false,
|
|
335800
|
+
action: normalizedAction,
|
|
335801
|
+
error: `ComputerUse is disabled for ${scope.ownerLabel}. Enable ComputerUse for this conversation before sending desktop operations.`,
|
|
335802
|
+
computer_use_enabled: false,
|
|
335803
|
+
requested_owner: scope.ownerLabel
|
|
335804
|
+
}, null, 2);
|
|
335805
|
+
}
|
|
335806
|
+
if (normalizedAction === "takeover_start") this.enabledByRuntime.set(runtimeKey, true);
|
|
335807
|
+
if (!this.activeLease) {
|
|
335808
|
+
this.activeLease = { ...scope, runtimeKey, updatedAt: now2 };
|
|
335809
|
+
} else {
|
|
335810
|
+
this.activeLease.updatedAt = now2;
|
|
335811
|
+
}
|
|
335812
|
+
return null;
|
|
335813
|
+
}
|
|
335814
|
+
complete(action, scope) {
|
|
335815
|
+
const normalizedAction = String(action || "").trim().toLowerCase();
|
|
335816
|
+
const runtimeKey = String(scope.runtimeKey || "").trim() || "conversation:default";
|
|
335817
|
+
if (normalizedAction === "takeover_stop") {
|
|
335818
|
+
if (!this.activeLease || this.activeLease.runtimeKey === runtimeKey) this.activeLease = null;
|
|
335819
|
+
this.enabledByRuntime.set(runtimeKey, false);
|
|
335820
|
+
return;
|
|
335821
|
+
}
|
|
335822
|
+
if (this.activeLease?.runtimeKey === runtimeKey) this.activeLease.updatedAt = Date.now();
|
|
335823
|
+
}
|
|
335824
|
+
setEnabled(scope, enabled) {
|
|
335825
|
+
const runtimeKey = String(scope.runtimeKey || "").trim() || "conversation:default";
|
|
335826
|
+
this.clearExpired();
|
|
335827
|
+
if (this.activeLease && this.activeLease.runtimeKey !== runtimeKey) {
|
|
335828
|
+
return { ok: false, error: this.occupiedError("toggle", scope.ownerLabel, this.activeLease.ownerLabel), state: this.state(runtimeKey) };
|
|
335829
|
+
}
|
|
335830
|
+
this.enabledByRuntime.set(runtimeKey, enabled !== false);
|
|
335831
|
+
if (enabled === false && this.activeLease?.runtimeKey === runtimeKey) this.activeLease = null;
|
|
335832
|
+
return { ok: true, state: this.state(runtimeKey) };
|
|
335833
|
+
}
|
|
335834
|
+
state(runtimeKey) {
|
|
335835
|
+
const key3 = String(runtimeKey || "").trim() || "conversation:default";
|
|
335836
|
+
this.clearExpired();
|
|
335837
|
+
const lease = this.activeLease;
|
|
335838
|
+
return {
|
|
335839
|
+
runtimeKey: key3,
|
|
335840
|
+
enabled: this.enabledByRuntime.get(key3) !== false,
|
|
335841
|
+
occupied: !!lease,
|
|
335842
|
+
...lease ? { ownerLabel: lease.ownerLabel, updatedAt: lease.updatedAt } : {}
|
|
335843
|
+
};
|
|
335844
|
+
}
|
|
335845
|
+
cancelTarget(runtimeKey) {
|
|
335846
|
+
const key3 = String(runtimeKey || "").trim();
|
|
335847
|
+
if (!key3) return false;
|
|
335848
|
+
const hadActiveLease = this.activeLease?.runtimeKey === key3;
|
|
335849
|
+
if (hadActiveLease) this.activeLease = null;
|
|
335850
|
+
this.enabledByRuntime.set(key3, false);
|
|
335851
|
+
return hadActiveLease;
|
|
335852
|
+
}
|
|
335853
|
+
clearExpired(now2 = Date.now()) {
|
|
335854
|
+
if (this.activeLease && now2 - this.activeLease.updatedAt > this.ttlMs) {
|
|
335855
|
+
this.activeLease = null;
|
|
335856
|
+
}
|
|
335857
|
+
}
|
|
335858
|
+
occupiedError(action, requestedOwner, activeOwner) {
|
|
335859
|
+
return JSON.stringify({
|
|
335860
|
+
ok: false,
|
|
335861
|
+
action,
|
|
335862
|
+
error: `${COMPUTER_USE_OCCUPIED_MARKER}: ComputerUse is already active in ${activeOwner}. Stop it with computer_use takeover_stop or wait before another conversation takes control.`,
|
|
335863
|
+
lock_owner: activeOwner,
|
|
335864
|
+
requested_owner: requestedOwner
|
|
335865
|
+
}, null, 2);
|
|
335866
|
+
}
|
|
335867
|
+
};
|
|
335868
|
+
var defaultComputerUseSessionRegistry = new ComputerUseSessionRegistry();
|
|
335869
|
+
|
|
335776
335870
|
// src/tools/index.ts
|
|
335777
335871
|
var globSync = require_index_min().sync;
|
|
335778
|
-
var computerUseLock = null;
|
|
335779
|
-
var COMPUTER_USE_LOCK_TTL_MS = 10 * 60 * 1e3;
|
|
335780
335872
|
function normalizeComputerUseAction(action) {
|
|
335781
335873
|
return String(action || "").trim().toLowerCase();
|
|
335782
335874
|
}
|
|
@@ -335861,49 +335953,24 @@ async function abortableToolDelay(durationMs, signal) {
|
|
|
335861
335953
|
if (signal?.aborted) abort();
|
|
335862
335954
|
});
|
|
335863
335955
|
}
|
|
335864
|
-
function
|
|
335865
|
-
|
|
335866
|
-
|
|
335867
|
-
|
|
335868
|
-
|
|
335869
|
-
function computerUseLockError(action, owner) {
|
|
335870
|
-
return JSON.stringify({
|
|
335871
|
-
ok: false,
|
|
335872
|
-
action,
|
|
335873
|
-
error: `ComputerUse is already active in ${computerUseLock?.owner || "another conversation"}. Stop it with computer_use takeover_stop or wait before using ComputerUse from another conversation.`,
|
|
335874
|
-
lock_owner: computerUseLock?.owner || "",
|
|
335875
|
-
requested_owner: owner
|
|
335876
|
-
}, null, 2);
|
|
335877
|
-
}
|
|
335878
|
-
function acquireComputerUseLock(action, owner, wsPath) {
|
|
335879
|
-
const now2 = Date.now();
|
|
335880
|
-
clearStaleComputerUseLock(now2);
|
|
335881
|
-
if (computerUseLock && computerUseLock.owner !== owner) {
|
|
335882
|
-
return computerUseLockError(action, owner);
|
|
335883
|
-
}
|
|
335884
|
-
computerUseLock = {
|
|
335885
|
-
owner,
|
|
335886
|
-
workspacePath: path15.resolve(wsPath || process.cwd()),
|
|
335887
|
-
acquiredAt: computerUseLock?.owner === owner ? computerUseLock.acquiredAt : now2,
|
|
335888
|
-
updatedAt: now2
|
|
335956
|
+
function computerUseSessionScope(context, wsPath, owner) {
|
|
335957
|
+
return {
|
|
335958
|
+
runtimeKey: browserUseScope(context, wsPath).runtimeKey,
|
|
335959
|
+
ownerLabel: owner,
|
|
335960
|
+
workspacePath: path15.resolve(wsPath || process.cwd())
|
|
335889
335961
|
};
|
|
335890
|
-
return null;
|
|
335891
335962
|
}
|
|
335892
|
-
function
|
|
335893
|
-
|
|
335894
|
-
if (computerUseLock && computerUseLock.owner !== owner) {
|
|
335895
|
-
return computerUseLockError(action, owner);
|
|
335896
|
-
}
|
|
335897
|
-
if (computerUseLock?.owner === owner) computerUseLock = null;
|
|
335898
|
-
return null;
|
|
335963
|
+
function acquireComputerUseLock(action, owner, wsPath, context = {}, dryRun = false) {
|
|
335964
|
+
return defaultComputerUseSessionRegistry.authorize(action, computerUseSessionScope(context, wsPath, owner), dryRun);
|
|
335899
335965
|
}
|
|
335900
|
-
function
|
|
335901
|
-
|
|
335902
|
-
|
|
335903
|
-
return computerUseLockError(action, owner);
|
|
335904
|
-
}
|
|
335966
|
+
function releaseComputerUseLock(action, owner, context = {}, wsPath = context.workspacePath || "") {
|
|
335967
|
+
const scope = computerUseSessionScope(context, wsPath, owner);
|
|
335968
|
+
defaultComputerUseSessionRegistry.complete(action, scope);
|
|
335905
335969
|
return null;
|
|
335906
335970
|
}
|
|
335971
|
+
function assertComputerUseLockOwner(action, owner, context = {}, wsPath = context.workspacePath || "") {
|
|
335972
|
+
return defaultComputerUseSessionRegistry.authorize(action, computerUseSessionScope(context, wsPath, owner));
|
|
335973
|
+
}
|
|
335907
335974
|
var ToolExecutor = class {
|
|
335908
335975
|
constructor(root2, config, ssh, workspace) {
|
|
335909
335976
|
this.config = config;
|
|
@@ -336454,7 +336521,7 @@ var ToolExecutor = class {
|
|
|
336454
336521
|
case "computer_use": {
|
|
336455
336522
|
const action = normalizeComputerUseAction(g2("action"));
|
|
336456
336523
|
const owner = `${computerUseOwner(context, wsPath)}:${String(context.actorId || "root")}`;
|
|
336457
|
-
const lockGuard = action === "takeover_stop" ? assertComputerUseLockOwner(action, owner) : acquireComputerUseLock(action, owner, wsPath);
|
|
336524
|
+
const lockGuard = action === "takeover_stop" ? assertComputerUseLockOwner(action, owner, context, wsPath) : acquireComputerUseLock(action, owner, wsPath, context, args.dry_run === true);
|
|
336458
336525
|
if (lockGuard) return lockGuard;
|
|
336459
336526
|
if (process.env.NEWMARK_WSL_DISTRO) {
|
|
336460
336527
|
try {
|
|
@@ -336468,7 +336535,7 @@ var ToolExecutor = class {
|
|
|
336468
336535
|
}, 12e4, context.signal);
|
|
336469
336536
|
return typeof result === "string" ? result : JSON.stringify(result);
|
|
336470
336537
|
} finally {
|
|
336471
|
-
if (action === "takeover_stop") releaseComputerUseLock(action, owner);
|
|
336538
|
+
if (action === "takeover_stop") releaseComputerUseLock(action, owner, context, wsPath);
|
|
336472
336539
|
}
|
|
336473
336540
|
}
|
|
336474
336541
|
if (process.env.NEWMARK_ISOLATED_RUNTIME === "1") {
|
|
@@ -336485,7 +336552,7 @@ var ToolExecutor = class {
|
|
|
336485
336552
|
const result = await requestUtilityHostTool("computer_use", args, trustedComputerUseContext, 12e4, context.signal);
|
|
336486
336553
|
return typeof result === "string" ? result : JSON.stringify(result);
|
|
336487
336554
|
} finally {
|
|
336488
|
-
if (action === "takeover_stop") releaseComputerUseLock(action, owner);
|
|
336555
|
+
if (action === "takeover_stop") releaseComputerUseLock(action, owner, context, wsPath);
|
|
336489
336556
|
}
|
|
336490
336557
|
}
|
|
336491
336558
|
const output = await runComputerUse({
|
|
@@ -336526,7 +336593,7 @@ var ToolExecutor = class {
|
|
|
336526
336593
|
durationMs: Number(step.duration_ms || 0)
|
|
336527
336594
|
})) : void 0
|
|
336528
336595
|
});
|
|
336529
|
-
if (action === "takeover_stop") releaseComputerUseLock(action, owner);
|
|
336596
|
+
if (action === "takeover_stop") releaseComputerUseLock(action, owner, context, wsPath);
|
|
336530
336597
|
return output;
|
|
336531
336598
|
}
|
|
336532
336599
|
case "terminal_takeover": {
|
|
@@ -337007,9 +337074,17 @@ ${snippet ? clean(snippet[1]) : ""}`.trim());
|
|
|
337007
337074
|
}
|
|
337008
337075
|
}
|
|
337009
337076
|
async browserRun(request, signal, context = {}, workspacePath = this.root) {
|
|
337077
|
+
const scope = browserUseScope(context, workspacePath);
|
|
337078
|
+
const scopedRequest = {
|
|
337079
|
+
...request,
|
|
337080
|
+
target: {
|
|
337081
|
+
workspaceId: context.workspaceId || terminalTakeoverWorkspaceId(workspacePath),
|
|
337082
|
+
conversationId: context.conversationId || "default",
|
|
337083
|
+
runtimeKey: scope.runtimeKey
|
|
337084
|
+
}
|
|
337085
|
+
};
|
|
337010
337086
|
if (process.env.NEWMARK_WSL_DISTRO) {
|
|
337011
|
-
const
|
|
337012
|
-
const result2 = await requestWindowsHostTool("browser_control", request, {
|
|
337087
|
+
const result2 = await requestWindowsHostTool("browser_control", scopedRequest, {
|
|
337013
337088
|
conversationId: context.conversationId || process.env.NEWMARK_CONVERSATION_ID || "default",
|
|
337014
337089
|
workspaceId: process.env.NEWMARK_WORKSPACE_ID || context.workspaceId || terminalTakeoverWorkspaceId(workspacePath),
|
|
337015
337090
|
actorId: context.actorId || ROOT_TERMINAL_ACTOR_ID,
|
|
@@ -337019,10 +337094,10 @@ ${snippet ? clean(snippet[1]) : ""}`.trim());
|
|
|
337019
337094
|
return this.formatBrowserResult(result2);
|
|
337020
337095
|
}
|
|
337021
337096
|
if (process.env.NEWMARK_ISOLATED_RUNTIME === "1") {
|
|
337022
|
-
const result2 = await requestUtilityHostTool("browser_control",
|
|
337097
|
+
const result2 = await requestUtilityHostTool("browser_control", scopedRequest, void 0, 3e4, signal);
|
|
337023
337098
|
return this.formatBrowserResult(result2);
|
|
337024
337099
|
}
|
|
337025
|
-
const result = await BrowserControl.run(
|
|
337100
|
+
const result = await BrowserControl.run(scopedRequest, signal);
|
|
337026
337101
|
return this.formatBrowserResult(result);
|
|
337027
337102
|
}
|
|
337028
337103
|
formatBrowserResult(result) {
|
|
@@ -339900,6 +339975,10 @@ var ProviderRunError = class extends Error {
|
|
|
339900
339975
|
function kernelTurnFailed(agent, turn) {
|
|
339901
339976
|
return turn.stopReason === "error" || agent.isLlmErrorText(turn.text);
|
|
339902
339977
|
}
|
|
339978
|
+
function providerTurnIsEmpty(turn) {
|
|
339979
|
+
return /provider returned an empty response/i.test(`${turn.errorMessage}
|
|
339980
|
+
${turn.text}`);
|
|
339981
|
+
}
|
|
339903
339982
|
function removeTrailingFailedAssistant(agent, messages) {
|
|
339904
339983
|
const last = messages[messages.length - 1];
|
|
339905
339984
|
if (last?.role !== "assistant") return;
|
|
@@ -340011,10 +340090,13 @@ async function runAgentKernel(agent) {
|
|
|
340011
340090
|
}
|
|
340012
340091
|
await kernel2.prompt(promptMessages);
|
|
340013
340092
|
const assistant = lastAssistant;
|
|
340093
|
+
const text = assistant ? KernelMessageText(assistant) : "";
|
|
340094
|
+
const hasToolCall = !!assistant?.content?.some((content) => content.type === "toolCall");
|
|
340095
|
+
const emptyResponse = !assistant || !text.trim() && !hasToolCall && String(assistant?.stopReason || "") !== "aborted";
|
|
340014
340096
|
return {
|
|
340015
|
-
text:
|
|
340097
|
+
text: emptyResponse ? "[Error] Provider returned an empty response." : text,
|
|
340016
340098
|
stopReason: String(assistant?.stopReason || ""),
|
|
340017
|
-
errorMessage: String(assistant?.errorMessage || "")
|
|
340099
|
+
errorMessage: String(assistant?.errorMessage || (emptyResponse ? "Provider returned an empty response." : ""))
|
|
340018
340100
|
};
|
|
340019
340101
|
} finally {
|
|
340020
340102
|
unsubscribe();
|
|
@@ -340049,6 +340131,16 @@ async function runAgentKernel(agent) {
|
|
|
340049
340131
|
if (modelBeforeKernelRun && modelBeforeKernelRun !== agent.model && !tokens.some((t3) => t3.text?.includes("[Model fallback]"))) {
|
|
340050
340132
|
tokens.unshift({ type: "text", text: `[Model fallback] ${modelBeforeKernelRun} unavailable; switched to ${agent.model}.` });
|
|
340051
340133
|
}
|
|
340134
|
+
let emptyResponseRetries = 0;
|
|
340135
|
+
while (providerTurnIsEmpty(lastTurn) && emptyResponseRetries < 2) {
|
|
340136
|
+
removeTrailingFailedAssistant(agent, kernel2.state.messages);
|
|
340137
|
+
emptyResponseRetries += 1;
|
|
340138
|
+
const notice = `[Model retry] Provider returned an empty response; retrying the same deployment (${emptyResponseRetries}/2).`;
|
|
340139
|
+
tokens.push({ type: "text", text: notice });
|
|
340140
|
+
agent.recordWorkStatus(notice);
|
|
340141
|
+
await agent.waitForPlannedRouteRetry();
|
|
340142
|
+
lastTurn = await runWithCompressionResume([], false);
|
|
340143
|
+
}
|
|
340052
340144
|
let routeRetries = 0;
|
|
340053
340145
|
while (kernelTurnFailed(agent, lastTurn) && routeRetries < 2) {
|
|
340054
340146
|
const previous = agent.switchToFallbackModel(lastTurn.errorMessage || lastTurn.text);
|
|
@@ -351079,8 +351171,26 @@ var GoalStateImpl = class {
|
|
|
351079
351171
|
return s3;
|
|
351080
351172
|
}
|
|
351081
351173
|
checkComplete(response) {
|
|
351082
|
-
const
|
|
351083
|
-
|
|
351174
|
+
const lines = String(response || "").replace(/\r\n?/g, "\n").split("\n");
|
|
351175
|
+
const completionMarkers = "(?:goal\\s+complete|objective\\s+achieved|task\\s+finished|all\\s+done|goal\\s+accomplished)";
|
|
351176
|
+
const explicitLinePatterns = [
|
|
351177
|
+
new RegExp(`^\\s*(?:[*#_~\\-]+\\s*)*(?:\\[\\s*)?${completionMarkers}(?:\\s*\\])?(?=\\s|[!.,:;]|$)`, "i"),
|
|
351178
|
+
/^\s*(?:[*#_~\-]+\s*)*(?:i|we)\s+(?:have\s+)?(?:now\s+)?(?:fully\s+)?(?:completed|finished|achieved|accomplished)\s+(?:the\s+)?(?:goal|objective|task)\b/i,
|
|
351179
|
+
/^\s*(?:[*#_~\-]+\s*)*(?:the\s+)?(?:goal|objective|task)\s+(?:is|was)\s+(?:now\s+)?(?:complete|achieved|finished|accomplished)\b/i
|
|
351180
|
+
];
|
|
351181
|
+
const completionContext = new RegExp(completionMarkers, "i");
|
|
351182
|
+
const deferredBefore = new RegExp(`\\b(?:must|will|should|would|can|could)\\s+(?:still\\s+)?(?:contain(?:s|ed)?|include(?:s|d)?|say|state|use|write|appear)\\b.{0,180}${completionMarkers}`, "i");
|
|
351183
|
+
const negatedBefore = new RegExp(`\\b(?:not|isn't|is not|never|don't|do not|won't|will not)\\b.{0,180}${completionMarkers}`, "i");
|
|
351184
|
+
const pendingBefore = new RegExp(`\\b(?:one\\s+step\\s+remains|still\\s+required|one\\s+more\\s+(?:step|call|turn)|not\\s+(?:the\\s+)?final)\\b.{0,180}${completionMarkers}`, "i");
|
|
351185
|
+
const deferredAfter = new RegExp(`${completionMarkers}.{0,180}\\b(?:not\\s+(?:the\\s+)?final|not\\s+yet|one\\s+more\\s+model\\s+call|next\\s+(?:call|step)|not\\s+done)\\b`, "i");
|
|
351186
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
351187
|
+
const line = lines[index];
|
|
351188
|
+
if (!explicitLinePatterns.some((pattern) => pattern.test(line))) continue;
|
|
351189
|
+
const context = lines.slice(Math.max(0, index - 2), Math.min(lines.length, index + 3)).join(" ");
|
|
351190
|
+
if (completionContext.test(context) && (deferredBefore.test(context) || negatedBefore.test(context) || pendingBefore.test(context) || deferredAfter.test(context))) continue;
|
|
351191
|
+
return true;
|
|
351192
|
+
}
|
|
351193
|
+
return false;
|
|
351084
351194
|
}
|
|
351085
351195
|
};
|
|
351086
351196
|
|
|
@@ -351277,6 +351387,7 @@ var ConversationKernel = class {
|
|
|
351277
351387
|
runtime.runner.recordGuideReceipt(deferred2);
|
|
351278
351388
|
this.emitQueueUpdate(runtime);
|
|
351279
351389
|
this.activateAcceptedGoal(runtime, envelope.goalObjective);
|
|
351390
|
+
this.schedulePendingRuntimeContinuation(runtime, runtime.runId);
|
|
351280
351391
|
return deferred2;
|
|
351281
351392
|
}
|
|
351282
351393
|
if (runtime.guideAcceptanceClosedRunId === runtime.runId) {
|
|
@@ -351308,6 +351419,7 @@ var ConversationKernel = class {
|
|
|
351308
351419
|
createdAt: deferred2.createdAt
|
|
351309
351420
|
}]);
|
|
351310
351421
|
this.activateAcceptedGoal(runtime, envelope.goalObjective);
|
|
351422
|
+
this.schedulePendingRuntimeContinuation(runtime, runtime.runId);
|
|
351311
351423
|
return deferred2;
|
|
351312
351424
|
}
|
|
351313
351425
|
const queued = runtime.runner.queueActiveKernelMessage(safeEnvelope.text, "steer", clientMessageId, runtime.runId, safeEnvelope.images);
|
|
@@ -351338,6 +351450,7 @@ var ConversationKernel = class {
|
|
|
351338
351450
|
createdAt: deferred.createdAt
|
|
351339
351451
|
}]);
|
|
351340
351452
|
this.activateAcceptedGoal(runtime, envelope.goalObjective);
|
|
351453
|
+
this.schedulePendingRuntimeContinuation(runtime, runtime.runId);
|
|
351341
351454
|
return deferred;
|
|
351342
351455
|
}
|
|
351343
351456
|
checkpoint(target) {
|
|
@@ -351545,6 +351658,8 @@ var ConversationKernel = class {
|
|
|
351545
351658
|
if (runtime.stopRequestedRunId === runId) {
|
|
351546
351659
|
stopped = true;
|
|
351547
351660
|
this.settleCooperativeStop(runtime, runId);
|
|
351661
|
+
} else if (runtime.pendingNextTurn.length > 0) {
|
|
351662
|
+
this.schedulePendingRuntimeContinuation(runtime, runId);
|
|
351548
351663
|
}
|
|
351549
351664
|
}
|
|
351550
351665
|
}
|
|
@@ -351679,7 +351794,8 @@ Review this persisted peer result and summarize or continue the parent task as n
|
|
|
351679
351794
|
guideAcceptanceClosedRunId: "",
|
|
351680
351795
|
guideReceipts: /* @__PURE__ */ new Map(),
|
|
351681
351796
|
guideEnvelopes: /* @__PURE__ */ new Map(),
|
|
351682
|
-
goalContinuationTimer: void 0
|
|
351797
|
+
goalContinuationTimer: void 0,
|
|
351798
|
+
pendingContinuationRunId: void 0
|
|
351683
351799
|
};
|
|
351684
351800
|
runner.setGoalContinuationGate(() => {
|
|
351685
351801
|
this.queueState(runtime);
|
|
@@ -351751,6 +351867,28 @@ Review this persisted peer result and summarize or continue the parent task as n
|
|
|
351751
351867
|
});
|
|
351752
351868
|
}, 250);
|
|
351753
351869
|
}
|
|
351870
|
+
schedulePendingRuntimeContinuation(runtime, runId) {
|
|
351871
|
+
if (runtime.pendingContinuationRunId === runId) return;
|
|
351872
|
+
runtime.pendingContinuationRunId = runId;
|
|
351873
|
+
const active = runtime.activePromise;
|
|
351874
|
+
if (active) {
|
|
351875
|
+
const continueAfterSettlement = () => {
|
|
351876
|
+
runtime.pendingContinuationRunId = void 0;
|
|
351877
|
+
this.schedulePendingRuntimeContinuation(runtime, runId);
|
|
351878
|
+
};
|
|
351879
|
+
void active.then(continueAfterSettlement, continueAfterSettlement);
|
|
351880
|
+
return;
|
|
351881
|
+
}
|
|
351882
|
+
setImmediate(() => {
|
|
351883
|
+
runtime.pendingContinuationRunId = void 0;
|
|
351884
|
+
if (runtime.runId !== runId || runtime.activePromise || runtime.stopRequestedRunId === runId) return;
|
|
351885
|
+
const next = runtime.pendingNextTurn.shift();
|
|
351886
|
+
if (!next) return;
|
|
351887
|
+
const message = typeof next.message === "string" ? { text: next.message, runId } : { ...next.message, runId: next.message.runId || runId };
|
|
351888
|
+
void this.prompt(message, runtime.target, runtime.options, next.queueMode).catch(() => {
|
|
351889
|
+
});
|
|
351890
|
+
});
|
|
351891
|
+
}
|
|
351754
351892
|
startGoalDrivenBuild(runtime) {
|
|
351755
351893
|
if (runtime.goalContinuationTimer) {
|
|
351756
351894
|
clearTimeout(runtime.goalContinuationTimer);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "newmark-agent",
|
|
3
3
|
"productName": "Newmark Agent",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.11",
|
|
5
5
|
"description": "Newmark Agent — Portable AI coding agent with rich GUI and CLI (TypeScript)",
|
|
6
6
|
"homepage": "https://github.com/positer/Newmark-Agent",
|
|
7
7
|
"repository": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"check-cross-platform-env": "node scripts/check-cross-platform-env.cjs",
|
|
53
53
|
"dist:harmonyos": "node scripts/dist-harmonyos.cjs",
|
|
54
54
|
"test:desktop": "npm run build && npm run test:desktop:built",
|
|
55
|
-
"test:desktop:built": "node dist/tests/verify.js && node dist/tests/contextSystemV2Verify.js && node dist/tests/contextSystemV2StressVerify.js && node dist/tests/providerAdapterV2Verify.js && node dist/tests/agentRuntimeV2Verify.js && node dist/tests/toolchainExposureV2Verify.js && node dist/tests/localOcrFallbackVerify.js && node dist/tests/dev018ModeSubagentStressVerify.js && node dist/tests/conversationBranchStressVerify.js && node dist/tests/conversationArchiveConcurrencyVerify.js && node dist/tests/memoryPolicyVerify.js && node dist/tests/newmarkSelectVerify.js && node dist/tests/mcpManagerVerify.js && node dist/tests/performanceOptimizationVerify.js && node dist/tests/compressionFidelityVerify.js && node dist/tests/responseTrajectoryVerify.js && node dist/tests/normalChatRegressionVerify.js && node dist/tests/dev008-subagent.js && node dist/tests/dev009Verify.js && node dist/tests/runtimeIsolationVerify.js && node dist/tests/runtimePoolCapacityVerify.js && node dist/tests/guideWorkRunVerify.js && node dist/tests/guideUiReconcileVerify.js && node dist/tests/queueAttachmentIsolationVerify.js && node dist/tests/workspaceMenuVerify.js && node dist/tests/userImagePersistenceVerify.js && node dist/tests/displayImageVerify.js && node dist/tests/visualPreferencesVerify.js && node dist/tests/browserUseVerify.js && node dist/tests/toolProcessVerify.js && node dist/tests/toolProvisioningVerify.js && node dist/tests/startupPrewarmVerify.js && node dist/tests/pdfPreviewServerVerify.js && node dist/tests/editorLifecycleVerify.js && node dist/tests/terminalTakeoverVerify.js && node dist/tests/workspaceFileRouterVerify.js && node dist/tests/computerUsePerformanceVerify.js && node dist/tests/autoRouterVerify.js && node dist/tests/autoAgentIntegrationVerify.js && node dist/tests/autoRouteRatingVerify.js && node dist/tests/providerIdentityVerify.js && node dist/tests/modelValidationVerify.js && node dist/tests/modelValidationAgentIntegrationVerify.js",
|
|
55
|
+
"test:desktop:built": "node dist/tests/verify.js && node dist/tests/computerUseSessionVerify.js && node dist/tests/contextSystemV2Verify.js && node dist/tests/contextSystemV2StressVerify.js && node dist/tests/providerAdapterV2Verify.js && node dist/tests/agentRuntimeV2Verify.js && node dist/tests/toolchainExposureV2Verify.js && node dist/tests/localOcrFallbackVerify.js && node dist/tests/dev018ModeSubagentStressVerify.js && node dist/tests/conversationBranchStressVerify.js && node dist/tests/conversationArchiveConcurrencyVerify.js && node dist/tests/memoryPolicyVerify.js && node dist/tests/newmarkSelectVerify.js && node dist/tests/mcpManagerVerify.js && node dist/tests/performanceOptimizationVerify.js && node dist/tests/compressionFidelityVerify.js && node dist/tests/responseTrajectoryVerify.js && node dist/tests/normalChatRegressionVerify.js && node dist/tests/dev008-subagent.js && node dist/tests/dev009Verify.js && node dist/tests/runtimeIsolationVerify.js && node dist/tests/runtimePoolCapacityVerify.js && node dist/tests/guideWorkRunVerify.js && node dist/tests/guideUiReconcileVerify.js && node dist/tests/queueAttachmentIsolationVerify.js && node dist/tests/workspaceMenuVerify.js && node dist/tests/userImagePersistenceVerify.js && node dist/tests/displayImageVerify.js && node dist/tests/visualPreferencesVerify.js && node dist/tests/browserUseVerify.js && node dist/tests/toolProcessVerify.js && node dist/tests/toolProvisioningVerify.js && node dist/tests/startupPrewarmVerify.js && node dist/tests/pdfPreviewServerVerify.js && node dist/tests/editorLifecycleVerify.js && node dist/tests/terminalTakeoverVerify.js && node dist/tests/workspaceFileRouterVerify.js && node dist/tests/computerUsePerformanceVerify.js && node dist/tests/autoRouterVerify.js && node dist/tests/autoAgentIntegrationVerify.js && node dist/tests/autoRouteRatingVerify.js && node dist/tests/providerIdentityVerify.js && node dist/tests/modelValidationVerify.js && node dist/tests/modelValidationAgentIntegrationVerify.js",
|
|
56
56
|
"test:conversation-branch-stress": "npm run build && node dist/tests/conversationBranchStressVerify.js",
|
|
57
57
|
"test:conversation-archive-concurrency": "npm run build && node dist/tests/conversationArchiveConcurrencyVerify.js",
|
|
58
58
|
"test:memory-policy": "npm run build && node dist/tests/memoryPolicyVerify.js",
|