newmark-agent 0.4.7 → 0.4.9
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 +407 -36
- package/dist/conversation-utility-host.js +3 -0
- package/dist/core/agent.d.ts +3 -0
- package/dist/core/agent.js +122 -10
- package/dist/core/agentKernelRunner.js +28 -11
- package/dist/core/autoRouter.d.ts +1 -1
- package/dist/core/autoRouter.js +16 -7
- package/dist/core/conversationKernel.d.ts +43 -0
- package/dist/core/conversationKernel.js +262 -8
- package/dist/core/electronUtilityAgentClient.d.ts +2 -0
- package/dist/core/electronUtilityAgentClient.js +5 -1
- package/dist/core/electronUtilityRuntimePool.d.ts +3 -0
- package/dist/core/electronUtilityRuntimePool.js +11 -0
- package/dist/core/toolPolicy.js +3 -0
- package/dist/core/utilityAgentProtocol.d.ts +23 -1
- package/dist/core/utilityHostToolRouter.js +18 -0
- package/dist/core/wslAgentClient.d.ts +2 -0
- package/dist/core/wslAgentClient.js +5 -1
- package/dist/core/wslAgentProtocol.d.ts +12 -1
- package/dist/core/wslAgentRuntimePool.d.ts +3 -0
- package/dist/core/wslAgentRuntimePool.js +11 -0
- package/dist/main.js +226 -13
- package/dist/preload.js +2 -0
- package/dist/server.d.ts +47 -1
- package/dist/server.js +304 -38
- package/dist/tools/index.js +46 -1
- package/dist/tools/nativeTools.js +1 -0
- package/dist/ui/index.html +150 -14
- package/dist/wsl-agent-host.bundle.cjs +407 -36
- package/dist/wsl-agent-host.js +3 -0
- package/package.json +5 -2
package/dist/main.js
CHANGED
|
@@ -120,6 +120,7 @@ let _forceQuit = false;
|
|
|
120
120
|
let forcedExitTimer = null;
|
|
121
121
|
let electronBrowserUseHost = null;
|
|
122
122
|
let browserUseEngine = null;
|
|
123
|
+
const mobileServerWorkEventSubscribers = new Set();
|
|
123
124
|
// A single renderer can host several hidden conversation-bound guests. The
|
|
124
125
|
// legacy host map is retained for focused-window discovery, while this map is
|
|
125
126
|
// the authoritative Browser-Use/right-sidebar binding.
|
|
@@ -288,7 +289,7 @@ async function resetWslAgentClient() {
|
|
|
288
289
|
if (wslAgentClient)
|
|
289
290
|
await wslAgentClient.resetAgent();
|
|
290
291
|
}
|
|
291
|
-
function broadcastAgentWorkEvent(event) {
|
|
292
|
+
function broadcastAgentWorkEvent(event, mirrorToMobile = true) {
|
|
292
293
|
const workEvent = event;
|
|
293
294
|
if ((workEvent.type === 'done' || workEvent.type === 'error') && workEvent.runtimeKey) {
|
|
294
295
|
browserUseEngine?.clearRuntime(workEvent.runtimeKey);
|
|
@@ -299,6 +300,14 @@ function broadcastAgentWorkEvent(event) {
|
|
|
299
300
|
continue;
|
|
300
301
|
win.webContents.send('agent:workEvent', event);
|
|
301
302
|
}
|
|
303
|
+
if (mirrorToMobile) {
|
|
304
|
+
for (const listener of mobileServerWorkEventSubscribers) {
|
|
305
|
+
try {
|
|
306
|
+
listener(event);
|
|
307
|
+
}
|
|
308
|
+
catch { /* ignore disconnected mobile bridge */ }
|
|
309
|
+
}
|
|
310
|
+
}
|
|
302
311
|
}
|
|
303
312
|
function ensureConversationKernel(root) {
|
|
304
313
|
if (!agent)
|
|
@@ -1882,16 +1891,195 @@ else {
|
|
|
1882
1891
|
ensureWorkspaceRegistryWatcher();
|
|
1883
1892
|
restoreStoredFlowSuspension();
|
|
1884
1893
|
recordStartup('agent-ready');
|
|
1885
|
-
//
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1894
|
+
// GUI 始终注册 mobile server 的运行时桥接;开关打开时才开始监听。
|
|
1895
|
+
// 这样从关闭态切到开启态时也能在当前 GUI 进程中原地重启服务。
|
|
1896
|
+
try {
|
|
1897
|
+
const { configureHostedServer, runServer } = require('./server');
|
|
1898
|
+
configureHostedServer(root, {
|
|
1899
|
+
agent,
|
|
1900
|
+
automation,
|
|
1901
|
+
onWorkEvent: event => broadcastAgentWorkEvent(event, false),
|
|
1902
|
+
subscribeWorkEvents: listener => {
|
|
1903
|
+
mobileServerWorkEventSubscribers.add(listener);
|
|
1904
|
+
return () => mobileServerWorkEventSubscribers.delete(listener);
|
|
1905
|
+
},
|
|
1906
|
+
conversationUiState: async (requested) => {
|
|
1907
|
+
const target = conversationRuntimeTarget(requested);
|
|
1908
|
+
const snapshot = wslBackendEnabled()
|
|
1909
|
+
? await ensureWslConversationPool().snapshot(target)
|
|
1910
|
+
: await ensureElectronUtilityPool().snapshot(target);
|
|
1911
|
+
const flowRunning = flowRunningForTarget(target);
|
|
1912
|
+
const flowSuspension = flowSuspensionForTarget(target);
|
|
1913
|
+
return {
|
|
1914
|
+
...snapshot,
|
|
1915
|
+
flow: flowRunning ? {
|
|
1916
|
+
running: true,
|
|
1917
|
+
paused: false,
|
|
1918
|
+
name: flowRunning.name,
|
|
1919
|
+
promptText: String(activeFlowStateFor(target)?.input || ''),
|
|
1920
|
+
message: '',
|
|
1921
|
+
} : flowSuspension ? {
|
|
1922
|
+
running: true,
|
|
1923
|
+
paused: true,
|
|
1924
|
+
name: flowSuspension.workflowName || '',
|
|
1925
|
+
promptText: String(flowSuspension.input || ''),
|
|
1926
|
+
message: String(flowSuspension.message || ''),
|
|
1927
|
+
reason: flowSuspension.reason || '',
|
|
1928
|
+
} : null,
|
|
1929
|
+
};
|
|
1930
|
+
},
|
|
1931
|
+
conversationUiAction: async (requested, action, value, input) => {
|
|
1932
|
+
const target = conversationRuntimeTarget(requested);
|
|
1933
|
+
if (action.startsWith('queue_')) {
|
|
1934
|
+
const queueAction = action === 'queue_enqueue' ? 'enqueue'
|
|
1935
|
+
: action === 'queue_update' ? 'update'
|
|
1936
|
+
: action === 'queue_delete' ? 'delete'
|
|
1937
|
+
: action === 'queue_reorder' ? 'reorder'
|
|
1938
|
+
: action === 'queue_toggle_pause' ? 'toggle_pause'
|
|
1939
|
+
: 'guide';
|
|
1940
|
+
const queueInput = {
|
|
1941
|
+
id: String(input?.id || ''),
|
|
1942
|
+
text: String(input?.text || value || ''),
|
|
1943
|
+
requestedMode: String(input?.requestedMode || 'build'),
|
|
1944
|
+
goalObjective: String(input?.goalObjective || ''),
|
|
1945
|
+
createdAt: String(input?.createdAt || ''),
|
|
1946
|
+
orderedIds: Array.isArray(input?.orderedIds)
|
|
1947
|
+
? input.orderedIds.map((id) => String(id || ''))
|
|
1948
|
+
: undefined,
|
|
1949
|
+
};
|
|
1950
|
+
return wslBackendEnabled()
|
|
1951
|
+
? await ensureWslConversationPool().queueAction(target, queueAction, queueInput)
|
|
1952
|
+
: await ensureElectronUtilityPool().queueAction(target, queueAction, queueInput);
|
|
1953
|
+
}
|
|
1954
|
+
if (action === 'goal_update') {
|
|
1955
|
+
return { goal: await mutateTargetConversation(target, () => {
|
|
1956
|
+
const isolated = isolatedConversationAgent(target);
|
|
1957
|
+
isolated.updateGoal(String(value || '').trim());
|
|
1958
|
+
isolated.setMode('goal');
|
|
1959
|
+
isolated.saveWorkspaceConversationState(true);
|
|
1960
|
+
return isolated.getConversationSnapshot(target.conversationId).goal;
|
|
1961
|
+
}) };
|
|
1962
|
+
}
|
|
1963
|
+
if (action === 'goal_guide' || action === 'conversation_guide') {
|
|
1964
|
+
const objective = action === 'goal_guide' ? String(value || '').trim() : '';
|
|
1965
|
+
const guideText = String(value || '').trim();
|
|
1966
|
+
const snapshot = wslBackendEnabled()
|
|
1967
|
+
? await ensureWslConversationPool().snapshot(target)
|
|
1968
|
+
: await ensureElectronUtilityPool().snapshot(target);
|
|
1969
|
+
const runtime = snapshot.runtime;
|
|
1970
|
+
if (!guideText || !runtime?.running || !runtime.runId) {
|
|
1971
|
+
return { ok: false, error: action === 'goal_guide'
|
|
1972
|
+
? 'There is no active Build for this Goal Guide.'
|
|
1973
|
+
: 'Target conversation is not running.' };
|
|
1974
|
+
}
|
|
1975
|
+
const prefix = 'Goal for the current Build:\n';
|
|
1976
|
+
const now = new Date().toISOString();
|
|
1977
|
+
const envelope = {
|
|
1978
|
+
clientMessageId: (0, crypto_1.randomUUID)(),
|
|
1979
|
+
guideId: (0, crypto_1.randomUUID)(),
|
|
1980
|
+
target: { workspaceId: target.workspaceId, conversationId: target.conversationId },
|
|
1981
|
+
runId: runtime.runId,
|
|
1982
|
+
deliveryMode: 'steer',
|
|
1983
|
+
text: objective ? prefix + objective : guideText,
|
|
1984
|
+
goalObjective: objective || undefined,
|
|
1985
|
+
createdAt: now,
|
|
1986
|
+
};
|
|
1987
|
+
const receipt = wslBackendEnabled()
|
|
1988
|
+
? await ensureWslConversationPool().enqueueGuide(envelope)
|
|
1989
|
+
: await ensureElectronUtilityPool().enqueueGuide(envelope);
|
|
1990
|
+
return { ok: receipt.status !== 'rejected', receipt };
|
|
1991
|
+
}
|
|
1992
|
+
if (action === 'goal_toggle_pause') {
|
|
1993
|
+
const resident = wslBackendEnabled()
|
|
1994
|
+
? await ensureWslConversationPool().toggleGoalPause(target)
|
|
1995
|
+
: await ensureElectronUtilityPool().toggleGoalPause(target);
|
|
1996
|
+
const paused = resident !== null ? resident : await mutateTargetConversation(target, () => isolatedConversationAgent(target).toggleGoalPause());
|
|
1997
|
+
return { ok: true, paused };
|
|
1998
|
+
}
|
|
1999
|
+
if (action === 'goal_clear') {
|
|
2000
|
+
const resident = wslBackendEnabled()
|
|
2001
|
+
? await ensureWslConversationPool().clearGoal(target)
|
|
2002
|
+
: await ensureElectronUtilityPool().clearGoal(target);
|
|
2003
|
+
if (resident === null)
|
|
2004
|
+
await mutateTargetConversation(target, () => isolatedConversationAgent(target).clearGoal());
|
|
2005
|
+
return { ok: true, cleared: true };
|
|
2006
|
+
}
|
|
2007
|
+
if (action === 'flow_pause')
|
|
2008
|
+
return await stopFlowForTarget(target);
|
|
2009
|
+
if (action === 'flow_resume')
|
|
2010
|
+
return await resumeFlowForTarget(String(value || ''), target);
|
|
2011
|
+
if (action === 'conversation_stop') {
|
|
2012
|
+
const snapshot = wslBackendEnabled()
|
|
2013
|
+
? await ensureWslConversationPool().snapshot(target)
|
|
2014
|
+
: await ensureElectronUtilityPool().snapshot(target);
|
|
2015
|
+
const runtime = snapshot.runtime;
|
|
2016
|
+
return wslBackendEnabled()
|
|
2017
|
+
? await ensureWslConversationPool().requestStop(target, runtime?.runId)
|
|
2018
|
+
: await ensureElectronUtilityPool().requestStop(target, runtime?.runId);
|
|
2019
|
+
}
|
|
2020
|
+
if (action === 'input_mode') {
|
|
2021
|
+
const mode = String(value || '') === 'next' ? 'next' : 'guide';
|
|
2022
|
+
const selected = wslBackendEnabled()
|
|
2023
|
+
? await ensureWslConversationPool().setInputMode(target, mode)
|
|
2024
|
+
: await ensureElectronUtilityPool().setInputMode(target, mode);
|
|
2025
|
+
return { ok: true, inputMode: selected || mode };
|
|
2026
|
+
}
|
|
2027
|
+
const flow = activeFlowStateFor(target);
|
|
2028
|
+
if (!flow?.abortController || !flow.flowAgent)
|
|
2029
|
+
return { ok: false, error: 'No active Flow accepts Guide input.' };
|
|
2030
|
+
const accepted = flow.flowAgent.queueActiveKernelMessage(String(value || '').trim(), 'steer') || false;
|
|
2031
|
+
return accepted ? { ok: true, accepted: true, flow: flow.name } : { ok: false, error: 'The current Flow Build is not accepting Guide input.' };
|
|
2032
|
+
},
|
|
2033
|
+
conversationPrompt: async (requested, message, requestedOptions) => {
|
|
2034
|
+
const target = conversationRuntimeTarget(requested);
|
|
2035
|
+
if (activeFlowStateFor(target))
|
|
2036
|
+
clearFlowSuspensionForNewWork(target);
|
|
2037
|
+
const snapshot = wslBackendEnabled()
|
|
2038
|
+
? await ensureWslConversationPool().snapshot(target)
|
|
2039
|
+
: await ensureElectronUtilityPool().snapshot(target);
|
|
2040
|
+
const requestedMode = String(requestedOptions?.requestedMode || '').toLowerCase();
|
|
2041
|
+
const goalObjective = String(requestedOptions?.goalObjective || '').trim();
|
|
2042
|
+
const mode = (goalObjective || requestedMode === 'goal') ? 'build' : String(snapshot.mode || 'build');
|
|
2043
|
+
const inputMode = String(requestedOptions?.inputMode || snapshot.inputMode || 'guide') === 'next' ? 'next' : 'guide';
|
|
2044
|
+
const options = {
|
|
2045
|
+
mode,
|
|
2046
|
+
model: String(snapshot.model || agent.ensureUsableModelSelection()),
|
|
2047
|
+
intelligence: String(snapshot.intelligence || agent.intelligence),
|
|
2048
|
+
inputMode,
|
|
2049
|
+
engine: agent.engine,
|
|
2050
|
+
};
|
|
2051
|
+
const queueMode = inputMode === 'guide' ? 'steer' : 'followUp';
|
|
2052
|
+
const promptMessage = goalObjective ? {
|
|
2053
|
+
text: message,
|
|
2054
|
+
visibleMode: 'goal',
|
|
2055
|
+
goalObjective,
|
|
2056
|
+
} : message;
|
|
2057
|
+
const result = wslBackendEnabled()
|
|
2058
|
+
? await ensureWslConversationPool().prompt({
|
|
2059
|
+
message: promptMessage,
|
|
2060
|
+
target,
|
|
2061
|
+
conversationId: target.conversationId,
|
|
2062
|
+
options,
|
|
2063
|
+
queueMode,
|
|
2064
|
+
workspace: target.workspace ? {
|
|
2065
|
+
id: target.workspace.id,
|
|
2066
|
+
name: target.workspace.name,
|
|
2067
|
+
path: target.workspace.path,
|
|
2068
|
+
isInternal: target.workspace.isInternal,
|
|
2069
|
+
kind: target.workspace.kind,
|
|
2070
|
+
} : null,
|
|
2071
|
+
})
|
|
2072
|
+
: await ensureElectronUtilityPool().prompt({ message: promptMessage, target, options, queueMode });
|
|
2073
|
+
return { ...result };
|
|
2074
|
+
},
|
|
2075
|
+
});
|
|
2076
|
+
if (agent.config.getBool('remote', 'touch_enabled')) {
|
|
1889
2077
|
runServer(root);
|
|
1890
2078
|
recordStartup('mobile-server-hosted');
|
|
1891
2079
|
}
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
2080
|
+
}
|
|
2081
|
+
catch (error) {
|
|
2082
|
+
console.error('[Newmark] hosted mobile server failed:', error instanceof Error ? error.message : String(error));
|
|
1895
2083
|
}
|
|
1896
2084
|
}
|
|
1897
2085
|
};
|
|
@@ -1976,6 +2164,8 @@ else {
|
|
|
1976
2164
|
return result.tokens.map(token => token.text).join('');
|
|
1977
2165
|
});
|
|
1978
2166
|
startupAgent.setAutomationManager(automation);
|
|
2167
|
+
const { setHostedServerAutomation } = require('./server');
|
|
2168
|
+
setHostedServerAutomation(automation);
|
|
1979
2169
|
automation.onChange(items => {
|
|
1980
2170
|
setTimeout(() => {
|
|
1981
2171
|
try {
|
|
@@ -2676,7 +2866,7 @@ else {
|
|
|
2676
2866
|
return await utilityHostToolHandler({ ...request, target: routedTarget, context: routedContext }, signal);
|
|
2677
2867
|
}
|
|
2678
2868
|
const result = await utilityHostToolHandler({ ...request, target: routedTarget, context: routedContext }, signal);
|
|
2679
|
-
return request.tool === 'computer_use' ? prepareWslComputerUseVisionResult(result) : result;
|
|
2869
|
+
return request.tool === 'computer_use' || request.tool === 'screen_capture' ? prepareWslComputerUseVisionResult(result) : result;
|
|
2680
2870
|
};
|
|
2681
2871
|
runWslHostTool.cancelTarget = (runtimeKey) => utilityHostToolHandler.cancelTarget(runtimeKey);
|
|
2682
2872
|
const ensureWslConversationPool = () => {
|
|
@@ -3036,7 +3226,7 @@ else {
|
|
|
3036
3226
|
}
|
|
3037
3227
|
}
|
|
3038
3228
|
});
|
|
3039
|
-
|
|
3229
|
+
const resumeFlowForTarget = async (response, targetInput) => {
|
|
3040
3230
|
if (!agent)
|
|
3041
3231
|
return { ok: false, error: 'No suspended Flow is waiting for user input.' };
|
|
3042
3232
|
const requestedTarget = targetInput ? conversationRuntimeTarget(targetInput) : null;
|
|
@@ -3170,7 +3360,8 @@ else {
|
|
|
3170
3360
|
await setTargetFlowMode(flowTarget, suspension.previousMode);
|
|
3171
3361
|
}
|
|
3172
3362
|
}
|
|
3173
|
-
}
|
|
3363
|
+
};
|
|
3364
|
+
electron_1.ipcMain.handle('flow:resume', async (_event, response, targetInput) => await resumeFlowForTarget(response, targetInput));
|
|
3174
3365
|
electron_1.ipcMain.handle('agent:setMode', async (_event, mode) => {
|
|
3175
3366
|
if (agent) {
|
|
3176
3367
|
const nextMode = mode;
|
|
@@ -3693,10 +3884,31 @@ else {
|
|
|
3693
3884
|
electronUtilityRuntimePool?.updateSetting(section, key, value),
|
|
3694
3885
|
wslAgentRuntimePool?.updateSetting(section, key, value),
|
|
3695
3886
|
]);
|
|
3887
|
+
if (section === 'remote' && key === 'touch_enabled') {
|
|
3888
|
+
const { setHostedServerEnabled } = require('./server');
|
|
3889
|
+
await setHostedServerEnabled(value === true || value === 'on');
|
|
3890
|
+
}
|
|
3696
3891
|
return true;
|
|
3697
3892
|
}
|
|
3698
3893
|
return false;
|
|
3699
3894
|
});
|
|
3895
|
+
electron_1.ipcMain.handle('mobile:serverStatus', async () => {
|
|
3896
|
+
if (!agent)
|
|
3897
|
+
return { enabled: false, listening: false, reachable: false, state: 'off', host: '', port: 47890, error: 'Agent not initialized', checkedAt: new Date().toISOString(), startedAt: 0 };
|
|
3898
|
+
const enabled = agent.config.getBool('remote', 'touch_enabled');
|
|
3899
|
+
const { hostedServerStatus } = require('./server');
|
|
3900
|
+
return await hostedServerStatus(enabled);
|
|
3901
|
+
});
|
|
3902
|
+
electron_1.ipcMain.handle('mobile:setRemoteTouchEnabled', async (_event, value) => {
|
|
3903
|
+
if (!agent)
|
|
3904
|
+
return { ok: false, error: 'Agent not initialized' };
|
|
3905
|
+
const enabled = value === true;
|
|
3906
|
+
agent.config.set('remote', 'touch_enabled', enabled);
|
|
3907
|
+
agent.config.save();
|
|
3908
|
+
const { setHostedServerEnabled } = require('./server');
|
|
3909
|
+
const status = await setHostedServerEnabled(enabled);
|
|
3910
|
+
return { ok: true, ...status };
|
|
3911
|
+
});
|
|
3700
3912
|
electron_1.ipcMain.handle('agent:openGlobalConfig', async () => {
|
|
3701
3913
|
if (!agent)
|
|
3702
3914
|
return { error: 'Agent is not initialized' };
|
|
@@ -3743,7 +3955,7 @@ else {
|
|
|
3743
3955
|
const accepted = state.flowAgent.queueActiveKernelMessage(text, 'steer') || false;
|
|
3744
3956
|
return accepted ? { ok: true, accepted: true, flow: state.name } : { ok: false, error: 'The current Flow Build is not accepting Guide input.' };
|
|
3745
3957
|
});
|
|
3746
|
-
|
|
3958
|
+
const stopFlowForTarget = async (targetInput) => {
|
|
3747
3959
|
if (!agent)
|
|
3748
3960
|
return { ok: true, action: 'not_running' };
|
|
3749
3961
|
const target = targetInput
|
|
@@ -3781,7 +3993,8 @@ else {
|
|
|
3781
3993
|
controller.abort(new Error(`Flow interrupted by user: ${flowName}`));
|
|
3782
3994
|
state.flowAgent?.abortActiveKernelRun();
|
|
3783
3995
|
return { ok: true, action: 'stopping', flow: flowName };
|
|
3784
|
-
}
|
|
3996
|
+
};
|
|
3997
|
+
electron_1.ipcMain.handle('flow:stop', async (_event, targetInput) => await stopFlowForTarget(targetInput));
|
|
3785
3998
|
electron_1.ipcMain.handle('agent:readGlobalPrompt', async () => {
|
|
3786
3999
|
if (!agent)
|
|
3787
4000
|
return { error: 'Agent is not initialized' };
|
package/dist/preload.js
CHANGED
|
@@ -139,6 +139,8 @@ contextBridge.exposeInMainWorld('api', {
|
|
|
139
139
|
updateVersion: () => ipcRenderer.invoke('update:version'),
|
|
140
140
|
mobilePairingQr: () => ipcRenderer.invoke('mobile:pairingQr'),
|
|
141
141
|
mobilePairingStatus: () => ipcRenderer.invoke('mobile:pairingStatus'),
|
|
142
|
+
mobileServerStatus: () => ipcRenderer.invoke('mobile:serverStatus'),
|
|
143
|
+
setRemoteTouchEnabled: (enabled) => ipcRenderer.invoke('mobile:setRemoteTouchEnabled', enabled),
|
|
142
144
|
updateCheckGithub: (input) => ipcRenderer.invoke('update:checkGithub', input),
|
|
143
145
|
updateApplyGithub: (input) => ipcRenderer.invoke('update:applyGithub', input),
|
|
144
146
|
updateInstallLocal: (input) => ipcRenderer.invoke('update:installLocal', input),
|
package/dist/server.d.ts
CHANGED
|
@@ -1,3 +1,49 @@
|
|
|
1
|
+
import { Agent, AgentWorkEvent } from './core/agent';
|
|
2
|
+
import { AutomationManager } from './core/automation';
|
|
3
|
+
export interface HostedMobileServerOptions {
|
|
4
|
+
agent?: Agent;
|
|
5
|
+
automation?: AutomationManager | null;
|
|
6
|
+
/** Mobile-originated runs must reach the already-open desktop renderer. */
|
|
7
|
+
onWorkEvent?: (event: AgentWorkEvent) => void;
|
|
8
|
+
/** Desktop GUI/runtime-pool events must reach mobile SSE subscribers. */
|
|
9
|
+
subscribeWorkEvents?: (listener: (event: AgentWorkEvent) => void) => (() => void);
|
|
10
|
+
/** Read the GUI runtime-pool state for one exact workspace/conversation. */
|
|
11
|
+
conversationUiState?: (target: {
|
|
12
|
+
workspaceId: string;
|
|
13
|
+
conversationId: string;
|
|
14
|
+
}) => Promise<Record<string, unknown>>;
|
|
15
|
+
/** Mutate Goal/Flow state owned by the GUI runtime pool for one exact target. */
|
|
16
|
+
conversationUiAction?: (target: {
|
|
17
|
+
workspaceId: string;
|
|
18
|
+
conversationId: string;
|
|
19
|
+
}, action: 'goal_update' | 'goal_guide' | 'conversation_guide' | 'goal_toggle_pause' | 'goal_clear' | 'flow_pause' | 'flow_resume' | 'flow_guide' | 'conversation_stop' | 'input_mode' | 'queue_enqueue' | 'queue_update' | 'queue_delete' | 'queue_reorder' | 'queue_toggle_pause' | 'queue_guide', value?: string, input?: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
20
|
+
/** Send through the same GUI runtime pool used by the desktop renderer. */
|
|
21
|
+
conversationPrompt?: (target: {
|
|
22
|
+
workspaceId: string;
|
|
23
|
+
conversationId: string;
|
|
24
|
+
}, message: string, options?: {
|
|
25
|
+
requestedMode?: string;
|
|
26
|
+
goalObjective?: string;
|
|
27
|
+
inputMode?: string;
|
|
28
|
+
}) => Promise<Record<string, unknown>>;
|
|
29
|
+
}
|
|
30
|
+
export interface HostedMobileServerStatus {
|
|
31
|
+
enabled: boolean;
|
|
32
|
+
listening: boolean;
|
|
33
|
+
reachable: boolean;
|
|
34
|
+
state: 'off' | 'listening' | 'error';
|
|
35
|
+
host: string;
|
|
36
|
+
port: number;
|
|
37
|
+
error: string;
|
|
38
|
+
checkedAt: string;
|
|
39
|
+
startedAt: number;
|
|
40
|
+
}
|
|
41
|
+
export declare function configureHostedServer(root: string, options?: HostedMobileServerOptions): void;
|
|
42
|
+
export declare function stopHostedServer(): Promise<void>;
|
|
43
|
+
export declare function hostedServerStatus(enabled?: boolean, probeHost?: string): Promise<HostedMobileServerStatus>;
|
|
44
|
+
export declare function setHostedServerEnabled(enabled: boolean, probeHost?: string): Promise<HostedMobileServerStatus>;
|
|
1
45
|
/** 托管启动 server(GUI/TUI 内嵌调用;幂等防重入,进程常驻即服务常驻) */
|
|
2
|
-
export declare function runServer(root: string): void;
|
|
46
|
+
export declare function runServer(root: string, options?: HostedMobileServerOptions): void;
|
|
47
|
+
/** Attach the GUI-owned automation manager after deferred startup. */
|
|
48
|
+
export declare function setHostedServerAutomation(manager: AutomationManager): void;
|
|
3
49
|
//# sourceMappingURL=server.d.ts.map
|