newmark-agent 0.4.9 → 0.5.0
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/conversation-utility-host.bundle.cjs +118 -11
- package/dist/core/conversationKernel.d.ts +2 -0
- package/dist/core/conversationKernel.js +68 -10
- package/dist/core/workEventCoalescer.d.ts +16 -0
- package/dist/core/workEventCoalescer.js +52 -0
- package/dist/llm/provider.d.ts +5 -0
- package/dist/llm/provider.js +63 -1
- package/dist/main.js +21 -2
- package/dist/server.d.ts +1 -0
- package/dist/server.js +181 -3
- package/dist/ui/index.html +145 -37
- package/dist/wsl-agent-host.bundle.cjs +118 -11
- package/package.json +6 -4
|
@@ -329456,6 +329456,7 @@ var LLMProvider = class _LLMProvider {
|
|
|
329456
329456
|
thinkingTierMaps;
|
|
329457
329457
|
static nodeHttpTransport = null;
|
|
329458
329458
|
static powershellTransport = null;
|
|
329459
|
+
temperatureUnsupported = /* @__PURE__ */ new Set();
|
|
329459
329460
|
effectiveRequestTimeout(timeoutMs) {
|
|
329460
329461
|
const requested = Number.isFinite(timeoutMs) && timeoutMs > 0 ? timeoutMs : DEFAULT_PROVIDER_REQUEST_TIMEOUT_MS;
|
|
329461
329462
|
const configured = Number.isFinite(this.requestTimeoutMs) && this.requestTimeoutMs > 0 ? this.requestTimeoutMs : DEFAULT_PROVIDER_REQUEST_TIMEOUT_MS;
|
|
@@ -329597,7 +329598,46 @@ var LLMProvider = class _LLMProvider {
|
|
|
329597
329598
|
"X-GitHub-Api-Version": "2022-11-28"
|
|
329598
329599
|
};
|
|
329599
329600
|
}
|
|
329601
|
+
temperatureCapabilityKey(url, body) {
|
|
329602
|
+
return `${url}|${String(body.model || "")}`;
|
|
329603
|
+
}
|
|
329604
|
+
unsupportedTemperatureError(status, raw) {
|
|
329605
|
+
if (status !== 400) return false;
|
|
329606
|
+
try {
|
|
329607
|
+
const parsed = JSON.parse(String(raw || ""));
|
|
329608
|
+
if (String(parsed?.error?.param || "").toLowerCase() === "temperature") return true;
|
|
329609
|
+
return /unsupported parameter[^\n]*temperature|temperature[^\n]*not supported/i.test(String(parsed?.error?.message || ""));
|
|
329610
|
+
} catch {
|
|
329611
|
+
return /unsupported parameter[^\n]*temperature|temperature[^\n]*not supported/i.test(String(raw || ""));
|
|
329612
|
+
}
|
|
329613
|
+
}
|
|
329614
|
+
requestBodyForTemperatureCapability(url, body) {
|
|
329615
|
+
const prepared = { ...body };
|
|
329616
|
+
if (this.temperatureUnsupported.has(this.temperatureCapabilityKey(url, body))) delete prepared.temperature;
|
|
329617
|
+
return prepared;
|
|
329618
|
+
}
|
|
329600
329619
|
async postJsonWithFetchFallback(url, headers, body, timeoutMs = 12e4, signal) {
|
|
329620
|
+
const prepared = this.requestBodyForTemperatureCapability(url, body);
|
|
329621
|
+
const response = await this.postJsonOnce(url, headers, prepared, timeoutMs, signal);
|
|
329622
|
+
if (prepared.temperature === void 0 || response.status !== 400) return response;
|
|
329623
|
+
const cloneable = typeof response.clone === "function";
|
|
329624
|
+
const errorText = await (cloneable ? response.clone() : response).text();
|
|
329625
|
+
if (!this.unsupportedTemperatureError(response.status, errorText)) {
|
|
329626
|
+
if (cloneable) return response;
|
|
329627
|
+
return {
|
|
329628
|
+
ok: response.ok,
|
|
329629
|
+
status: response.status,
|
|
329630
|
+
headers: response.headers,
|
|
329631
|
+
text: async () => errorText,
|
|
329632
|
+
json: async () => JSON.parse(errorText || "{}")
|
|
329633
|
+
};
|
|
329634
|
+
}
|
|
329635
|
+
this.temperatureUnsupported.add(this.temperatureCapabilityKey(url, body));
|
|
329636
|
+
const retryBody = { ...body };
|
|
329637
|
+
delete retryBody.temperature;
|
|
329638
|
+
return this.postJsonOnce(url, headers, retryBody, timeoutMs, signal);
|
|
329639
|
+
}
|
|
329640
|
+
async postJsonOnce(url, headers, body, timeoutMs = 12e4, signal) {
|
|
329601
329641
|
const effectiveTimeout = this.effectiveRequestTimeout(timeoutMs);
|
|
329602
329642
|
if (this.isPlainHttpLoopback(url)) {
|
|
329603
329643
|
const pathname = (() => {
|
|
@@ -330266,6 +330306,7 @@ ${responsePath}
|
|
|
330266
330306
|
*/
|
|
330267
330307
|
buildProviderAdapterTransport() {
|
|
330268
330308
|
return async (request, signal) => {
|
|
330309
|
+
request.body = this.requestBodyForTemperatureCapability(request.url, request.body);
|
|
330269
330310
|
if (request.body?.stream === true) {
|
|
330270
330311
|
const abort = new AbortController();
|
|
330271
330312
|
const forwardAbort = () => abort.abort(signal?.reason);
|
|
@@ -330275,12 +330316,27 @@ ${responsePath}
|
|
|
330275
330316
|
const timer = setTimeout(() => abort.abort(providerTimeoutError(effectiveTimeout)), effectiveTimeout);
|
|
330276
330317
|
try {
|
|
330277
330318
|
try {
|
|
330278
|
-
|
|
330319
|
+
let response2 = await fetch(request.url, {
|
|
330279
330320
|
method: "POST",
|
|
330280
330321
|
headers: request.headers,
|
|
330281
330322
|
body: JSON.stringify(request.body),
|
|
330282
330323
|
signal: abort.signal
|
|
330283
330324
|
});
|
|
330325
|
+
if (request.body.temperature !== void 0 && response2.status === 400) {
|
|
330326
|
+
const errorText = await response2.clone().text();
|
|
330327
|
+
if (this.unsupportedTemperatureError(response2.status, errorText)) {
|
|
330328
|
+
this.temperatureUnsupported.add(this.temperatureCapabilityKey(request.url, request.body));
|
|
330329
|
+
const retryBody = { ...request.body };
|
|
330330
|
+
delete retryBody.temperature;
|
|
330331
|
+
response2 = await fetch(request.url, {
|
|
330332
|
+
method: "POST",
|
|
330333
|
+
headers: request.headers,
|
|
330334
|
+
body: JSON.stringify(retryBody),
|
|
330335
|
+
signal: abort.signal
|
|
330336
|
+
});
|
|
330337
|
+
}
|
|
330338
|
+
}
|
|
330339
|
+
return response2;
|
|
330284
330340
|
} catch (error) {
|
|
330285
330341
|
if (signal?.aborted) throw abortFailure(signal);
|
|
330286
330342
|
if (abort.signal.aborted) throw abortFailure(abort.signal);
|
|
@@ -353575,7 +353631,7 @@ ${item.goalObjective}` : item.text,
|
|
|
353575
353631
|
if (!clientMessageId) return { ...base2, reason: "clientMessageId is required" };
|
|
353576
353632
|
const existing = runtime ? this.guideReceipt(runtime, clientMessageId) : void 0;
|
|
353577
353633
|
if (existing) return existing;
|
|
353578
|
-
if (!runtime?.
|
|
353634
|
+
if (!runtime?.runId) {
|
|
353579
353635
|
return { ...base2, reason: "Target conversation is not running" };
|
|
353580
353636
|
}
|
|
353581
353637
|
if (requestedRunId && requestedRunId !== runtime.runId) {
|
|
@@ -353583,6 +353639,10 @@ ${item.goalObjective}` : item.text,
|
|
|
353583
353639
|
runtime.guideReceipts.set(clientMessageId, rejected);
|
|
353584
353640
|
return runtime.runner.recordGuideReceipt(rejected);
|
|
353585
353641
|
}
|
|
353642
|
+
const canReactivateFinalizingRun = !runtime.activePromise && runtime.guideAcceptanceClosedRunId === runtime.runId && (!requestedRunId || requestedRunId === runtime.runId);
|
|
353643
|
+
if (!runtime.activePromise && !canReactivateFinalizingRun) {
|
|
353644
|
+
return { ...base2, reason: "Target conversation is not running" };
|
|
353645
|
+
}
|
|
353586
353646
|
let safeImages = [];
|
|
353587
353647
|
let safeAttachments = [];
|
|
353588
353648
|
try {
|
|
@@ -353677,6 +353737,8 @@ ${item.goalObjective}` : item.text,
|
|
|
353677
353737
|
attachments: safeAttachments.map((attachment) => ({ ...attachment })),
|
|
353678
353738
|
createdAt: deferred2.createdAt
|
|
353679
353739
|
}]);
|
|
353740
|
+
this.trackQueuedMessage(runtime, safeEnvelope.text, "steer");
|
|
353741
|
+
this.emitQueueUpdate(runtime);
|
|
353680
353742
|
this.activateAcceptedGoal(runtime, envelope.goalObjective);
|
|
353681
353743
|
this.schedulePendingRuntimeContinuation(runtime, runtime.runId);
|
|
353682
353744
|
return deferred2;
|
|
@@ -353941,6 +354003,7 @@ ${item.goalObjective}` : item.text,
|
|
|
353941
354003
|
activePromise = (async () => {
|
|
353942
354004
|
let result = null;
|
|
353943
354005
|
let stopped = false;
|
|
354006
|
+
let failed = false;
|
|
353944
354007
|
try {
|
|
353945
354008
|
result = await this.run(runtime, message, options);
|
|
353946
354009
|
stopped = runtime.runId === runId && runtime.stopRequestedRunId === runId;
|
|
@@ -353948,6 +354011,8 @@ ${item.goalObjective}` : item.text,
|
|
|
353948
354011
|
if (runtime.runId === runId && runtime.stopRequestedRunId === runId) {
|
|
353949
354012
|
stopped = true;
|
|
353950
354013
|
} else {
|
|
354014
|
+
failed = true;
|
|
354015
|
+
this.stopAutomaticContinuationAfterError(runtime, runId);
|
|
353951
354016
|
runtime.runner.finishConversationWorkRun(
|
|
353952
354017
|
runId,
|
|
353953
354018
|
"error",
|
|
@@ -353962,12 +354027,12 @@ ${item.goalObjective}` : item.text,
|
|
|
353962
354027
|
if (runtime.stopRequestedRunId === runId) {
|
|
353963
354028
|
stopped = true;
|
|
353964
354029
|
this.settleCooperativeStop(runtime, runId);
|
|
353965
|
-
} else if (!runtime.queuePaused && runtime.pendingNextTurn.length > 0) {
|
|
354030
|
+
} else if (!failed && !runtime.queuePaused && runtime.pendingNextTurn.length > 0) {
|
|
353966
354031
|
this.schedulePendingRuntimeContinuation(runtime, runId);
|
|
353967
354032
|
}
|
|
353968
354033
|
}
|
|
353969
354034
|
}
|
|
353970
|
-
if (!stopped && runtime.runId === runId) this.scheduleGoalContinuation(runtime, runId);
|
|
354035
|
+
if (!failed && !stopped && runtime.runId === runId) this.scheduleGoalContinuation(runtime, runId);
|
|
353971
354036
|
if (stopped) {
|
|
353972
354037
|
const settled = this.result(runtime, []);
|
|
353973
354038
|
if (result?.tokens) settled.tokens = result.tokens;
|
|
@@ -353989,6 +354054,28 @@ ${item.goalObjective}` : item.text,
|
|
|
353989
354054
|
this.emitQueueUpdate(runtime);
|
|
353990
354055
|
return true;
|
|
353991
354056
|
}
|
|
354057
|
+
stopAutomaticContinuationAfterError(runtime, runId) {
|
|
354058
|
+
if (runtime.runId !== runId) return;
|
|
354059
|
+
if (runtime.goalContinuationTimer) {
|
|
354060
|
+
clearTimeout(runtime.goalContinuationTimer);
|
|
354061
|
+
runtime.goalContinuationTimer = void 0;
|
|
354062
|
+
}
|
|
354063
|
+
runtime.pendingContinuationRunId = void 0;
|
|
354064
|
+
this.rejectOutstandingGuides(runtime, "The provider failed before this Guide could be applied; submit again to retry.");
|
|
354065
|
+
runtime.pendingNextTurn = runtime.pendingNextTurn.filter((item) => {
|
|
354066
|
+
const automatic = item.queueMode === "steer" || typeof item.message !== "string" && item.message.hiddenUserInput === true;
|
|
354067
|
+
if (automatic) {
|
|
354068
|
+
runtime.runner.consumeConversationContinuation({
|
|
354069
|
+
content: typeof item.message === "string" ? item.message : item.message.text,
|
|
354070
|
+
queueMode: item.queueMode,
|
|
354071
|
+
clientMessageId: typeof item.message === "string" ? void 0 : item.message.clientMessageId
|
|
354072
|
+
});
|
|
354073
|
+
}
|
|
354074
|
+
return !automatic;
|
|
354075
|
+
});
|
|
354076
|
+
this.queueState(runtime);
|
|
354077
|
+
this.emitQueueUpdate(runtime);
|
|
354078
|
+
}
|
|
353992
354079
|
async run(runtime, message, options) {
|
|
353993
354080
|
this.applyOptions(runtime.runner, options);
|
|
353994
354081
|
let lastTokens = await this.runSingle(runtime, message);
|
|
@@ -354082,7 +354169,13 @@ Review this persisted peer result and summarize or continue the parent task as n
|
|
|
354082
354169
|
this.consumeQueuedMessage(runtime, typeof message === "string" ? message : message.text);
|
|
354083
354170
|
const timeoutMs = this.processTimeoutMs(runtime);
|
|
354084
354171
|
if (timeoutMs <= 0) {
|
|
354085
|
-
|
|
354172
|
+
let tokens;
|
|
354173
|
+
try {
|
|
354174
|
+
tokens = await runtime.runner.process(message);
|
|
354175
|
+
} catch (error) {
|
|
354176
|
+
this.consumeFailedAutomaticContinuation(runtime, message, continuationMode);
|
|
354177
|
+
throw error;
|
|
354178
|
+
}
|
|
354086
354179
|
if (continuationMode) runtime.runner.consumeConversationContinuation({
|
|
354087
354180
|
content: typeof message === "string" ? message : message.text,
|
|
354088
354181
|
queueMode: continuationMode,
|
|
@@ -354092,12 +354185,18 @@ Review this persisted peer result and summarize or continue the parent task as n
|
|
|
354092
354185
|
}
|
|
354093
354186
|
let timeout;
|
|
354094
354187
|
try {
|
|
354095
|
-
|
|
354096
|
-
|
|
354097
|
-
|
|
354098
|
-
|
|
354099
|
-
|
|
354100
|
-
|
|
354188
|
+
let tokens;
|
|
354189
|
+
try {
|
|
354190
|
+
tokens = await Promise.race([
|
|
354191
|
+
runtime.runner.process(message),
|
|
354192
|
+
new Promise((_3, reject) => {
|
|
354193
|
+
timeout = setTimeout(() => reject(new Error(`Process timeout (${Math.round(timeoutMs / 1e3)}s)`)), timeoutMs);
|
|
354194
|
+
})
|
|
354195
|
+
]);
|
|
354196
|
+
} catch (error) {
|
|
354197
|
+
this.consumeFailedAutomaticContinuation(runtime, message, continuationMode);
|
|
354198
|
+
throw error;
|
|
354199
|
+
}
|
|
354101
354200
|
if (continuationMode) runtime.runner.consumeConversationContinuation({
|
|
354102
354201
|
content: typeof message === "string" ? message : message.text,
|
|
354103
354202
|
queueMode: continuationMode,
|
|
@@ -354108,6 +354207,14 @@ Review this persisted peer result and summarize or continue the parent task as n
|
|
|
354108
354207
|
if (timeout) clearTimeout(timeout);
|
|
354109
354208
|
}
|
|
354110
354209
|
}
|
|
354210
|
+
consumeFailedAutomaticContinuation(runtime, message, continuationMode) {
|
|
354211
|
+
if (!continuationMode || typeof message === "string" || message.hiddenUserInput !== true) return;
|
|
354212
|
+
runtime.runner.consumeConversationContinuation({
|
|
354213
|
+
content: message.text,
|
|
354214
|
+
queueMode: continuationMode,
|
|
354215
|
+
clientMessageId: message.clientMessageId
|
|
354216
|
+
});
|
|
354217
|
+
}
|
|
354111
354218
|
processTimeoutMs(runtime) {
|
|
354112
354219
|
const raw = runtime.runner.config.getNum("agent", "process_timeout_ms") || this.host.config.getNum("agent", "process_timeout_ms");
|
|
354113
354220
|
if (!Number.isFinite(raw) || raw <= 0) return 0;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "newmark-agent",
|
|
3
3
|
"productName": "Newmark Agent",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
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": {
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"typecheck": "tsc --noEmit",
|
|
45
45
|
"lint": "oxlint src",
|
|
46
46
|
"test": "npm run test:full-release",
|
|
47
|
-
"test:full-release": "npm run build && npm run test:desktop:built && npm run test:intelligence-tier:built && npm run test:tui:built && npm run test:mode-conversation-stress:built && npm run check-cross-platform-env && npm run test:ssh-tui-stress:built && npm run test:wsl-tui-stress:built && npm run test:cli:built && npm run test:gui-tui-cli-stress:built",
|
|
47
|
+
"test:full-release": "npm run build && node dist/tests/conversationHistoryFirstVerify.js && npm run test:desktop:built && npm run test:intelligence-tier:built && npm run test:tui:built && npm run test:mode-conversation-stress:built && npm run check-cross-platform-env && npm run test:ssh-tui-stress:built && npm run test:wsl-tui-stress:built && npm run test:cli:built && npm run test:gui-tui-cli-stress:built",
|
|
48
48
|
"test:intelligence-tier:built": "node dist/tests/intelligenceTierVerify.js",
|
|
49
49
|
"test:mode-conversation-stress": "node scripts/mode-conversation-state-stress.cjs",
|
|
50
50
|
"test:mode-conversation-stress:built": "node scripts/mode-conversation-state-stress.cjs",
|
|
51
51
|
"check-cross-platform-env": "node scripts/check-cross-platform-env.cjs",
|
|
52
52
|
"dist:harmonyos": "node scripts/dist-harmonyos.cjs",
|
|
53
|
-
"test:desktop": "npm run build && npm run test:desktop:built",
|
|
53
|
+
"test:desktop": "npm run build && node dist/tests/conversationHistoryFirstVerify.js && npm run test:desktop:built",
|
|
54
54
|
"test:deletion-safety": "npm run build && npm run test:deletion-safety:built",
|
|
55
55
|
"test:deletion-safety:built": "node scripts/deletion-safety-stress.cjs",
|
|
56
56
|
"test:desktop:built": "node dist/tests/verify.js && node dist/tests/thinkingTierMapCacheStressVerify.js && node dist/tests/computerUseSessionVerify.js && node dist/tests/contextSystemV2Verify.js && node dist/tests/contextSystemV2StressVerify.js && node dist/tests/providerAdapterV2Verify.js && node dist/tests/providerTimeoutRecoveryVerify.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/conversationArchiveRuntimeVerify.js && node dist/tests/dev040ComprehensiveStressVerify.js && node dist/tests/memoryPolicyVerify.js && node dist/tests/newmarkSelectVerify.js && node dist/tests/mcpManagerVerify.js && node dist/tests/dshCompatibilityVerify.js && node dist/tests/performanceOptimizationVerify.js && node scripts/compression-pressure-stress.cjs && 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/modelSwitchBehaviorVerify.js && node scripts/flow-pause-stop-draft-stress.cjs && 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/taskToolsVerify.js && node dist/tests/contextCacheHitStressVerify.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/screenCaptureIndependentVerify.js && node dist/tests/computerUsePerformanceVerify.js && node dist/tests/autoRouterVerify.js && node dist/tests/autoAgentIntegrationVerify.js && node dist/tests/modelRecoveryStressVerify.js && node dist/tests/autoRouteRatingVerify.js && node dist/tests/providerIdentityVerify.js && node dist/tests/modelValidationVerify.js && node dist/tests/modelValidationAgentIntegrationVerify.js && node scripts/deletion-safety-stress.cjs",
|
|
@@ -97,7 +97,9 @@
|
|
|
97
97
|
"test:native-bash": "npm run build && node dist/tests/nativeBashVerify.js",
|
|
98
98
|
"test:automation-bash-stress": "npm run build && node dist/tests/automationBashStressVerify.js",
|
|
99
99
|
"dist:win": "npm run build:clean && node scripts/dist-portable.cjs",
|
|
100
|
-
"release": "
|
|
100
|
+
"release": "node scripts/release-all.cjs",
|
|
101
|
+
"release:version-check": "node scripts/sync-release-version.cjs --check",
|
|
102
|
+
"release:version-set": "node scripts/sync-release-version.cjs --set",
|
|
101
103
|
"dist:portable": "npm run test:full-release && npm run build:clean && node scripts/dist-portable.cjs",
|
|
102
104
|
"release:cli-smoke": "node scripts/release-cli-smoke.cjs",
|
|
103
105
|
"release:context-compress-cli-stress": "node scripts/release-context-compress-cli-stress.cjs",
|