@tangle-network/agent-app 4.0.18 → 4.0.19
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.
|
@@ -3,7 +3,7 @@ import { z } from 'zod'
|
|
|
3
3
|
import { Sandbox } from '@tangle-network/sandbox/core'
|
|
4
4
|
import { HubClient } from '@tangle-network/hub-sdk'
|
|
5
5
|
import { agentProfileSchema, defineAgentProfilePublicConfig as publicValue,
|
|
6
|
-
|
|
6
|
+
mergeAgentProfiles } from '@tangle-network/agent-interface'
|
|
7
7
|
import { GENERAL_AGENT_MODEL, GENERAL_AGENT_SYSTEM_PROMPT, DEFAULT_AGENT_HOME,
|
|
8
8
|
withDefaultAgentHome, agentHomeWorkflows } from '../../dist/hosted-agent/index.js'
|
|
9
9
|
|
|
@@ -80,8 +80,10 @@ export function buildGeneralAgent(configInput) {
|
|
|
80
80
|
mcp: { tangle_agent: { transport: 'stdio', command: 'node',
|
|
81
81
|
args: [publicValue(config.runtimeModule), publicValue('serve')],
|
|
82
82
|
env: {
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
// Variable names, not values: OpenCode starts this server with its own env, so the
|
|
84
|
+
// server reads the box's model key and proxy by name and the profile names no secret.
|
|
85
|
+
TANGLE_AGENT_ROUTER_KEY_ENV: publicValue(config.routerKeyEnv),
|
|
86
|
+
TANGLE_AGENT_PROXY_ENV: publicValue(config.proxyEnv),
|
|
85
87
|
TANGLE_AGENT_HOME: publicValue(config.home), TANGLE_AGENT_CHROMIUM: publicValue(config.chromium),
|
|
86
88
|
TANGLE_AGENT_MODEL: publicValue(config.model), TANGLE_AGENT_IMAGE_MODEL: publicValue(config.imageModel),
|
|
87
89
|
TANGLE_AGENT_VIDEO_MODEL: publicValue(config.videoModel),
|
|
@@ -15,6 +15,8 @@ function required(name) {
|
|
|
15
15
|
if (!value) throw new Error(`Missing ${name}; provision the published general-agent image before serving the line`)
|
|
16
16
|
return value
|
|
17
17
|
}
|
|
18
|
+
// Profiles name the variable to read; the direct value is for lines provisioned before that.
|
|
19
|
+
const named = (nameEnv, legacy) => required(process.env[nameEnv]?.trim() || legacy)
|
|
18
20
|
function https(value) {
|
|
19
21
|
const url = new URL(value)
|
|
20
22
|
if (url.protocol !== 'https:' || url.username || url.password) throw new Error('A credential-free HTTPS URL is required')
|
|
@@ -29,14 +31,14 @@ export async function serve() {
|
|
|
29
31
|
for (const name of ['TangleSearchClient', 'TangleReadClient']) {
|
|
30
32
|
if (typeof router[name] !== 'function') throw new Error(`The installed published agent-integrations lacks ${name}; release #326 and rebuild the image`)
|
|
31
33
|
}
|
|
32
|
-
const options = { apiKey:
|
|
34
|
+
const options = { apiKey: named('TANGLE_AGENT_ROUTER_KEY_ENV', 'TANGLE_AGENT_ROUTER_KEY'), baseUrl: 'https://router.tangle.tools' }
|
|
33
35
|
const search = new router.TangleSearchClient(options)
|
|
34
36
|
const read = new router.TangleReadClient(options)
|
|
35
37
|
const media = new TCloud({ apiKey: options.apiKey, baseURL: 'https://router.tangle.tools/v1', retry: false, timeout: 120_000 })
|
|
36
38
|
const model = required('TANGLE_AGENT_MODEL')
|
|
37
39
|
const imageModel = required('TANGLE_AGENT_IMAGE_MODEL')
|
|
38
40
|
const videoModel = required('TANGLE_AGENT_VIDEO_MODEL')
|
|
39
|
-
const proxy = new URL(
|
|
41
|
+
const proxy = new URL(named('TANGLE_AGENT_PROXY_ENV', 'TANGLE_AGENT_BROWSER_PROXY'))
|
|
40
42
|
if (!['http:', 'https:', 'socks5:'].includes(proxy.protocol) || proxy.username || proxy.password) {
|
|
41
43
|
throw new Error('Use the sandbox allowlist proxy without credentials in its URL')
|
|
42
44
|
}
|
package/package.json
CHANGED