|
@@ -27,6 +27,8 @@ import type {
|
|
|
} from '../shared/workspace.js'
|
|
} from '../shared/workspace.js'
|
|
|
import { buildWorkspacePrompt } from './workspacePrompt.js'
|
|
import { buildWorkspacePrompt } from './workspacePrompt.js'
|
|
|
import { buildWorkspaceEnvironment, workspaceEnvironmentTools } from './workspaceEnvironment.js'
|
|
import { buildWorkspaceEnvironment, workspaceEnvironmentTools } from './workspaceEnvironment.js'
|
|
|
|
|
+import { parseHermesRuntimeMetadata } from './hermesRuntimeEnvironment.js'
|
|
|
|
|
+import type { HermesRuntimeMetadata } from '../shared/botEnvironment.js'
|
|
|
import { readHostTools } from './hostToolSettings.js'
|
|
import { readHostTools } from './hostToolSettings.js'
|
|
|
import { resolveBotModelSettings, applyBotModelSettings, botModelTarget, BotModelConfirmationError } from './botModelSettings.js'
|
|
import { resolveBotModelSettings, applyBotModelSettings, botModelTarget, BotModelConfirmationError } from './botModelSettings.js'
|
|
|
function globalComputers(home: string) {
|
|
function globalComputers(home: string) {
|
|
@@ -165,12 +167,13 @@ export class WorkspaceRuntime extends WorkspaceScheduler {
|
|
|
send(owner: string, conversationId: string, input: unknown): Run {
|
|
send(owner: string, conversationId: string, input: unknown): Run {
|
|
|
return this.submit(owner, conversationId, input)
|
|
return this.submit(owner, conversationId, input)
|
|
|
}
|
|
}
|
|
|
- async botCapabilities(owner: string, agent: Agent, target = this.nodes.target(owner, agent.nodeId)): Promise<{ tools: boolean; memory: boolean; extraction: boolean }> {
|
|
|
|
|
|
|
+ async botCapabilities(owner: string, agent: Agent, target = this.nodes.target(owner, agent.nodeId)): Promise<{ tools: boolean; memory: boolean; extraction: boolean; runtime?: HermesRuntimeMetadata }> {
|
|
|
try {
|
|
try {
|
|
|
const response = await target.session.request('/api/plugins/yaoyao-bot-bridge/capabilities', { search: new URLSearchParams({ profile: agent.profile }) })
|
|
const response = await target.session.request('/api/plugins/yaoyao-bot-bridge/capabilities', { search: new URLSearchParams({ profile: agent.profile }) })
|
|
|
const value = JSON.parse(response.body.toString())
|
|
const value = JSON.parse(response.body.toString())
|
|
|
const tools = response.status === 200 && value.ready === true && value.native_tools === true && value.in_process === true
|
|
const tools = response.status === 200 && value.ready === true && value.native_tools === true && value.in_process === true
|
|
|
- return { tools, memory: tools && value.memory_isolation === true, extraction: value.memory_extraction === true }
|
|
|
|
|
|
|
+ const runtime = response.status === 200 ? parseHermesRuntimeMetadata(value.runtime_environment, agent.profile) : undefined
|
|
|
|
|
+ return { tools, memory: tools && value.memory_isolation === true, extraction: value.memory_extraction === true, ...(runtime ? { runtime } : {}) }
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
if (error instanceof HttpError && RESOURCE_WAIT_CODES.has(error.code ?? '')) throw error
|
|
if (error instanceof HttpError && RESOURCE_WAIT_CODES.has(error.code ?? '')) throw error
|
|
|
return { tools: false, memory: false, extraction: false }
|
|
return { tools: false, memory: false, extraction: false }
|
|
@@ -823,7 +826,7 @@ export class WorkspaceRuntime extends WorkspaceScheduler {
|
|
|
const globals=globalComputers(this.store.home)
|
|
const globals=globalComputers(this.store.home)
|
|
|
const desktopSnapshot=this.desktopEnvironments?.snapshot(owner,agent,root.deviceHost,{script:globals.scriptMachine,server:globals.serverComputer,maxMiB:globals.fileTransferMaxMiB})
|
|
const desktopSnapshot=this.desktopEnvironments?.snapshot(owner,agent,root.deviceHost,{script:globals.scriptMachine,server:globals.serverComputer,maxMiB:globals.fileTransferMaxMiB})
|
|
|
??{capturedAt:Date.now(),sourceHost:root.deviceHost,hosts:[]}
|
|
??{capturedAt:Date.now(),sourceHost:root.deviceHost,hosts:[]}
|
|
|
- const environment=buildWorkspaceEnvironment({agent,globals,execution,serverDesktop:agent.nodeId==='local'&&isLocalAuthorizationTarget(target.url),desktop:desktopSnapshot,bridge:botCapabilities.tools,cloud:!!this.cloud?.selected(owner,agent),plugins:!!this.plugins?.selected(owner,agent),managedBrowser:this.managedBrowsers?.available(owner,agent)})
|
|
|
|
|
|
|
+ const environment=buildWorkspaceEnvironment({agent,globals,execution,runtime:{connected:gateway.connected,...(botCapabilities.runtime?{metadata:botCapabilities.runtime}:{})},serverDesktop:agent.nodeId==='local'&&isLocalAuthorizationTarget(target.url),desktop:desktopSnapshot,bridge:botCapabilities.tools,cloud:!!this.cloud?.selected(owner,agent),plugins:!!this.plugins?.selected(owner,agent),managedBrowser:this.managedBrowsers?.available(owner,agent)})
|
|
|
const {cloud,plugins,vm:dispatchedVm}=environment.tools
|
|
const {cloud,plugins,vm:dispatchedVm}=environment.tools
|
|
|
const desktop=environment.tools.desktopView||environment.tools.desktopFile
|
|
const desktop=environment.tools.desktopView||environment.tools.desktopFile
|
|
|
const desktopEpochs=Object.fromEntries(environment.desktop.hosts.map(host=>[host.id,host.epoch??'']))
|
|
const desktopEpochs=Object.fromEntries(environment.desktop.hosts.map(host=>[host.id,host.epoch??'']))
|