newmark-agent 0.4.0 → 0.4.3
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/config.example.json +5 -0
- package/dist/conversation-utility-host.bundle.cjs +419 -34
- package/dist/core/agent.d.ts +52 -4
- package/dist/core/agent.js +260 -23
- package/dist/core/agentKernelRunner.js +33 -16
- package/dist/core/config.d.ts +8 -0
- package/dist/core/conversationKernel.d.ts +16 -0
- package/dist/core/conversationKernel.js +34 -1
- package/dist/core/toolPolicy.d.ts +9 -0
- package/dist/core/toolPolicy.js +128 -0
- package/dist/llm/provider.d.ts +13 -1
- package/dist/llm/provider.js +42 -1
- package/dist/providers/provider-adapter.d.ts +3 -1
- package/dist/toolchain/registry-seeder.js +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +31 -1
- package/dist/tools/nativeTools.js +1 -0
- package/dist/tui/src/app.js +24 -0
- package/dist/tui/src/i18n.js +151 -0
- package/dist/tui/src/render.js +205 -90
- package/dist/tui/src/state.js +86 -0
- package/dist/ui/index.html +239 -71
- package/dist/ui/lucide-sprite.svg +5 -0
- package/dist/wsl-agent-host.bundle.cjs +419 -34
- package/package.json +7 -11
- package/Flow/Electron-Debug-Release.Flow.json +0 -43
- package/Flow/Flow.md +0 -9
- package/Flow/UI-Feature-Integration.Flow.json +0 -96
package/dist/tui/src/state.js
CHANGED
|
@@ -183,6 +183,8 @@ function createState(options = {}) {
|
|
|
183
183
|
workflowDraft: { name: "", mode: "build", prompt: "" },
|
|
184
184
|
workflowFormIndex: 0,
|
|
185
185
|
flowSelectionIndex: 0,
|
|
186
|
+
flowSelectionScroll: 0,
|
|
187
|
+
conversationListScroll: 0,
|
|
186
188
|
flowByConversation: initialFlow ? { [`${target.workspaceId}::${target.conversationId}`]: initialFlow } : {},
|
|
187
189
|
currentFlow: initialFlow,
|
|
188
190
|
theme: appearance.theme,
|
|
@@ -192,14 +194,20 @@ function createState(options = {}) {
|
|
|
192
194
|
settingChoiceIndex: 0,
|
|
193
195
|
paletteQuery: "",
|
|
194
196
|
paletteIndex: 0,
|
|
197
|
+
paletteScroll: 0,
|
|
195
198
|
inputMode: false,
|
|
196
199
|
input: "",
|
|
197
200
|
inputCursor: 0,
|
|
198
201
|
conversationScroll: 0,
|
|
199
202
|
conversationMaxScroll: 0,
|
|
203
|
+
contentScroll: 0,
|
|
204
|
+
contentFocusLine: -1,
|
|
200
205
|
conversationHistoryFocus: false,
|
|
201
206
|
historySelectedIndex: -1,
|
|
202
207
|
historySelectedImageIndex: -1,
|
|
208
|
+
historyEventFocus: false,
|
|
209
|
+
historyEventIndex: -1,
|
|
210
|
+
collapsedBuildEvents: new Set(),
|
|
203
211
|
historyVisibleRunIds: [],
|
|
204
212
|
historyCursorDirection: 0,
|
|
205
213
|
expandedBuildRuns: new Set(
|
|
@@ -549,6 +557,8 @@ function switchView(state, id) {
|
|
|
549
557
|
state.input = "";
|
|
550
558
|
state.inputCursor = 0;
|
|
551
559
|
if (id === "chat") state.conversationScroll = 0;
|
|
560
|
+
state.contentScroll = 0;
|
|
561
|
+
state.contentFocusLine = -1;
|
|
552
562
|
}
|
|
553
563
|
|
|
554
564
|
function normalizedAutomation(item) {
|
|
@@ -1330,6 +1340,76 @@ function filteredCommands(state) {
|
|
|
1330
1340
|
return data.commands.filter((command) => command.label.toLowerCase().includes(query));
|
|
1331
1341
|
}
|
|
1332
1342
|
|
|
1343
|
+
function focusableEventsForRun(run) {
|
|
1344
|
+
return (run?.events || [])
|
|
1345
|
+
.filter((event) => {
|
|
1346
|
+
const type = String(event?.type || "").toLowerCase();
|
|
1347
|
+
return type && type !== "final_response" && !type.startsWith("guide");
|
|
1348
|
+
})
|
|
1349
|
+
.sort((left, right) => {
|
|
1350
|
+
const leftSeq = Number(left?.sequence);
|
|
1351
|
+
const rightSeq = Number(right?.sequence);
|
|
1352
|
+
if (Number.isFinite(leftSeq) && Number.isFinite(rightSeq) && leftSeq !== rightSeq) return leftSeq - rightSeq;
|
|
1353
|
+
const leftTime = new Date(left?.timestamp || left?.createdAt || "").getTime();
|
|
1354
|
+
const rightTime = new Date(right?.timestamp || right?.createdAt || "").getTime();
|
|
1355
|
+
return (Number.isFinite(leftTime) ? leftTime : 0) - (Number.isFinite(rightTime) ? rightTime : 0);
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
function buildEventKey(event, index) {
|
|
1360
|
+
return String(event?.id || event?.toolCallId || `${event?.type || "event"}:${event?.toolName || ""}:${index}`);
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
function selectedHistoryRun(state) {
|
|
1364
|
+
const runs = [...(state.snapshot.workRuns || [])].sort((left, right) => Number(left.sequence || 0) - Number(right.sequence || 0));
|
|
1365
|
+
return runs[Number(state.historySelectedIndex) || 0];
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
function enterHistoryEventFocus(state) {
|
|
1369
|
+
const run = selectedHistoryRun(state);
|
|
1370
|
+
const events = focusableEventsForRun(run);
|
|
1371
|
+
if (!run || !state.expandedBuildRuns?.has(run.runId) || !events.length) return false;
|
|
1372
|
+
state.historyEventFocus = true;
|
|
1373
|
+
state.historyEventIndex = 0;
|
|
1374
|
+
state.historySelectedImageIndex = -1;
|
|
1375
|
+
state.notice = `History focus · ${events.length} item(s) · Enter expand · ← back`;
|
|
1376
|
+
return true;
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
function exitHistoryEventFocus(state) {
|
|
1380
|
+
state.historyEventFocus = false;
|
|
1381
|
+
state.historyEventIndex = -1;
|
|
1382
|
+
state.notice = "History focus · Build Block · Enter expands";
|
|
1383
|
+
return true;
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
function moveHistoryEventCursor(state, direction) {
|
|
1387
|
+
const run = selectedHistoryRun(state);
|
|
1388
|
+
const events = focusableEventsForRun(run);
|
|
1389
|
+
if (!events.length) return false;
|
|
1390
|
+
const count = events.length;
|
|
1391
|
+
state.historyEventIndex = ((Number(state.historyEventIndex) || 0) + direction + count) % count;
|
|
1392
|
+
state.notice = `History focus · item ${state.historyEventIndex + 1}/${count} · Enter expand`;
|
|
1393
|
+
return true;
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
function toggleSelectedBuildEvent(state) {
|
|
1397
|
+
const run = selectedHistoryRun(state);
|
|
1398
|
+
const events = focusableEventsForRun(run);
|
|
1399
|
+
const index = Number(state.historyEventIndex) || 0;
|
|
1400
|
+
const event = events[index];
|
|
1401
|
+
if (!event) return false;
|
|
1402
|
+
const key = buildEventKey(event, index);
|
|
1403
|
+
if (state.collapsedBuildEvents.has(key)) {
|
|
1404
|
+
state.collapsedBuildEvents.delete(key);
|
|
1405
|
+
state.notice = "Event expanded";
|
|
1406
|
+
} else {
|
|
1407
|
+
state.collapsedBuildEvents.add(key);
|
|
1408
|
+
state.notice = "Event collapsed";
|
|
1409
|
+
}
|
|
1410
|
+
return true;
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1333
1413
|
module.exports = {
|
|
1334
1414
|
activeConversationModelLabel,
|
|
1335
1415
|
INTELLIGENCE_TIERS,
|
|
@@ -1341,6 +1421,7 @@ module.exports = {
|
|
|
1341
1421
|
applyConversationResult,
|
|
1342
1422
|
beginAutomationCreate,
|
|
1343
1423
|
beginWorkflowCreate,
|
|
1424
|
+
buildEventKey,
|
|
1344
1425
|
conversationModelOptions,
|
|
1345
1426
|
createAutomationFromDraft,
|
|
1346
1427
|
createState,
|
|
@@ -1349,7 +1430,10 @@ module.exports = {
|
|
|
1349
1430
|
cycleMemoryComponent,
|
|
1350
1431
|
cycleSettingsTab,
|
|
1351
1432
|
enterConversation,
|
|
1433
|
+
enterHistoryEventFocus,
|
|
1434
|
+
exitHistoryEventFocus,
|
|
1352
1435
|
filteredCommands,
|
|
1436
|
+
focusableEventsForRun,
|
|
1353
1437
|
itemCount,
|
|
1354
1438
|
memoryColumnItems,
|
|
1355
1439
|
memoryTagOptions,
|
|
@@ -1358,6 +1442,7 @@ module.exports = {
|
|
|
1358
1442
|
moveMenuSelection,
|
|
1359
1443
|
moveFocusHorizontal,
|
|
1360
1444
|
moveConversationHistoryCursor,
|
|
1445
|
+
moveHistoryEventCursor,
|
|
1361
1446
|
moveInputCursorVertical,
|
|
1362
1447
|
moveSettingChoiceSelection,
|
|
1363
1448
|
moveSelection,
|
|
@@ -1378,6 +1463,7 @@ module.exports = {
|
|
|
1378
1463
|
toggleSelected,
|
|
1379
1464
|
toggleConversationPinned,
|
|
1380
1465
|
toggleSelectedBuildBlock,
|
|
1466
|
+
toggleSelectedBuildEvent,
|
|
1381
1467
|
validateSelectedModel,
|
|
1382
1468
|
workspaceMenuChildren
|
|
1383
1469
|
};
|