@zergai/ztc 0.26.4-dev.202611231953 → 0.26.6-dev.202611240947
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/README.md +384 -114
- package/bin/zmux-darwin-arm64 +0 -0
- package/bin/zmux-linux-x64 +0 -0
- package/bin/ztc-audio-darwin-arm64 +0 -0
- package/bin/ztc-capture-darwin-arm64 +0 -0
- package/bin/ztc-tui-darwin-arm64 +0 -0
- package/bin/ztc-tui-linux-x64 +0 -0
- package/bin/zterm-darwin-arm64 +1 -1
- package/dist/agent/backends/codex_app_server.d.ts +54 -9
- package/dist/agent/backends/codex_app_server.js +102 -20
- package/dist/agent/backends/zrouter_stream.d.ts +9 -8
- package/dist/agent/backends/zrouter_stream.js +19 -21
- package/dist/agent/commands/status.js +10 -5
- package/dist/agent/commands/types.d.ts +2 -0
- package/dist/agent/commands/update.js +6 -0
- package/dist/agent/runtime/cpu_benchmark.js +2 -0
- package/dist/agent/runtime/tool_runtime.d.ts +1 -1
- package/dist/agent/runtime/tool_runtime.js +7 -0
- package/dist/agent/tools/ml.js +36 -9
- package/dist/app/command_context.js +6 -1
- package/dist/cli_main.js +53 -10
- package/dist/cli_ratatui.js +8 -1
- package/dist/config/hosted_runtime.d.ts +71 -0
- package/dist/config/hosted_runtime.js +94 -0
- package/dist/config/permission_pin.d.ts +73 -12
- package/dist/config/permission_pin.js +99 -16
- package/dist/config/profile_limits.d.ts +11 -1
- package/dist/config/profile_limits.js +14 -0
- package/dist/config.d.ts +36 -5
- package/dist/config.js +90 -17
- package/dist/headless.js +17 -0
- package/dist/headless_cli.js +40 -7
- package/dist/hooks/types.d.ts +6 -0
- package/dist/lsp/client.d.ts +5 -2
- package/dist/lsp/client.js +42 -5
- package/dist/panes/agent_cli.d.ts +6 -0
- package/dist/panes/agent_cli.js +15 -2
- package/dist/panes/agent_panes.js +31 -11
- package/dist/utils/sandbox.d.ts +30 -1
- package/dist/utils/sandbox.js +586 -42
- package/dist/utils/subprocess_env.d.ts +15 -0
- package/dist/utils/subprocess_env.js +39 -1
- package/dist/utils/ztc_own_state.d.ts +25 -0
- package/dist/utils/ztc_own_state.js +78 -4
- package/dist/zlm-embed.mjs +11465 -10882
- package/npm-shrinkwrap.json +1 -1
- package/package.json +13 -13
package/bin/zmux-darwin-arm64
CHANGED
|
Binary file
|
package/bin/zmux-linux-x64
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/ztc-tui-darwin-arm64
CHANGED
|
Binary file
|
package/bin/ztc-tui-linux-x64
CHANGED
|
Binary file
|
package/bin/zterm-darwin-arm64
CHANGED
|
@@ -47,17 +47,62 @@ export interface CodexAppServerClientOptions {
|
|
|
47
47
|
turnTimeoutMs?: number;
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* the
|
|
50
|
+
* What a Codex whose environment is allowlisted (config/hosted_runtime.ts codexEnvAllowlisted: its host runs ZTC, or
|
|
51
|
+
* asks for that alone) is given of its environment besides the names the bubblewrap sandbox gives a command
|
|
52
|
+
* (utils/subprocess_env.ts buildCredentialSafeSubprocessEnv: CI, COLORTERM, FORCE_COLOR, HOME, LANG, LOGNAME, NO_COLOR,
|
|
53
|
+
* PATH, SHELL, TEMP, TERM, TMP, TMPDIR, TZ, USER and LC_*): where its sign-in is (CODEX_HOME); the certificates a host's
|
|
54
|
+
* private CA or TLS-inspecting proxy is trusted with (CODEX_CA_CERTIFICATE and SSL_CERT_FILE, which the codex binary
|
|
55
|
+
* reads, SSL_CERT_DIR, NODE_EXTRA_CA_CERTS, which the npm package's node launcher and the node tools its commands run
|
|
56
|
+
* read, and GIT_SSL_CAINFO, CURL_CA_BUNDLE and REQUESTS_CA_BUNDLE, which git, curl and Python's requests read for the
|
|
57
|
+
* commands it runs); and the proxy it reaches OpenAI through (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY and NO_PROXY, and their
|
|
58
|
+
* lowercase forms, which the codex binary reads, as curl, and so git, does). Nothing else: no key (CODEX_AUTH_JSON is
|
|
59
|
+
* none of these), no bearer, and none of the rest of the host's environment.
|
|
60
|
+
*/
|
|
61
|
+
export declare const CODEX_APP_SERVER_HOSTED_ENV: readonly string[];
|
|
62
|
+
/**
|
|
63
|
+
* Environment for the spawned `codex app-server`, pinned to the account's own credentials: the per-account CODEX_HOME
|
|
64
|
+
* (when given), and none of the stray auth overrides (CODEX_AUTH_OVERRIDE_ENV), even with no per-account home, so an
|
|
65
|
+
* ambient key never hijacks the default ChatGPT login.
|
|
66
|
+
*
|
|
67
|
+
* The app-server runs the commands Codex's model asks for with this environment, and every program its own git runs
|
|
68
|
+
* with it too: a work tree's filter driver (a clean filter a tracked .gitattributes selects and .git/config names), which
|
|
69
|
+
* codex leaves on for its git as it turns fsmonitor and hooks off, ran with it when the model's only command was `pwd`
|
|
70
|
+
* (E1 round 13). So, for every user, it starts from a user subprocess's (buildUserSubprocessEnv: none of ZTC's own
|
|
71
|
+
* credentials or its host's effort policy, under any name) without any ZergAI platform or Zerg Router bearer, whatever
|
|
72
|
+
* it holds, or another name for one (PLATFORM_ROUTER_BEARER_ENV): Codex never needs one. On the person's own computer the
|
|
73
|
+
* rest is theirs, their SSH agent and toolchains among it, which their builds and git need. Where Codex's environment is
|
|
74
|
+
* allowlisted (config/hosted_runtime.ts codexEnvAllowlisted: its host runs ZTC, as ZTC_HOSTED=1, a host's thread or
|
|
75
|
+
* ZTC_PERMISSION_PROFILE_PINNED says, or asks for that alone, with ZTC_CODEX_ENV_ALLOWLIST=1, as a ZergCloud zerg's
|
|
76
|
+
* entrypoint does) it is only the allowlisted names (buildCredentialSafeSubprocessEnv's, and
|
|
77
|
+
* CODEX_APP_SERVER_HOSTED_ENV): the rest of the host's environment reaches neither Codex nor anything it runs.
|
|
59
78
|
*/
|
|
60
79
|
export declare function buildCodexAppServerEnv(codexHome?: string, base?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
80
|
+
/**
|
|
81
|
+
* How ZTC starts a Codex pane (panes/agent_panes.ts openAgentPane: /codex, the chooser, the + menus, a resume, the
|
|
82
|
+
* workspace server's open_pane), over the environment its renderer gives each pane, SOURCE's, read as ZTC was started
|
|
83
|
+
* with it: it is given what the codex app-server is (buildCodexAppServerEnv), since Codex's own git runs a work tree's
|
|
84
|
+
* filter driver there too (E1 round 13). WITHHELD are the names the pane's environment blanks and its shell unsets
|
|
85
|
+
* before Codex starts:
|
|
86
|
+
*
|
|
87
|
+
* - for every user, every ZergAI platform and Zerg Router bearer (PLATFORM_ROUTER_BEARER_ENV), set or not, since a login
|
|
88
|
+
* file may export one, and every other variable of SOURCE holding one's value; the rest is the person's own, the
|
|
89
|
+
* sign-in methods their own Codex offers among it, since a pane runs on none of ZTC's accounts, where the app-server
|
|
90
|
+
* runs on the sign-in under its account's CODEX_HOME;
|
|
91
|
+
* - where Codex's environment is ALLOWLISTED (config/hosted_runtime.ts codexEnvAllowlisted), every name of SOURCE that
|
|
92
|
+
* the codex app-server isn't given there. Such a pane starts from no login shell, whose files are its host's, and with
|
|
93
|
+
* no workspace tools, whose pane relay would open a pane with the rest.
|
|
94
|
+
*/
|
|
95
|
+
export declare function codexPaneEnv(source?: NodeJS.ProcessEnv): {
|
|
96
|
+
allowlisted: boolean;
|
|
97
|
+
withheld: string[];
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* What a Codex request says where Codex's environment is allowlisted (codexEnvAllowlisted) and the app-server finds no
|
|
101
|
+
* sign-in under its CODEX_HOME. Every Codex with none is refused before a thread starts, so nothing was sent; there,
|
|
102
|
+
* nothing from the environment stands in for the sign-in, since the app-server is given no key (buildCodexAppServerEnv),
|
|
103
|
+
* and ZTC looks for none, so this says what its host does about it.
|
|
104
|
+
*/
|
|
105
|
+
export declare const CODEX_HOSTED_NO_SIGN_IN: string;
|
|
61
106
|
export interface CodexTurnOptions {
|
|
62
107
|
model: string;
|
|
63
108
|
system: string;
|
|
@@ -6,7 +6,9 @@ import { parseCodexModelRow } from '../../utils/codex_models.js';
|
|
|
6
6
|
import { ModelNotServedError } from './model_not_served.js';
|
|
7
7
|
import { getVersion } from '../../utils/version.js';
|
|
8
8
|
import { NativeObservationLimitError } from '../runtime/provider_native_evidence.js';
|
|
9
|
-
import {
|
|
9
|
+
import { hostLaunchEnvironment } from '../../config/host_credentials.js';
|
|
10
|
+
import { codexEnvAllowlisted } from '../../config/hosted_runtime.js';
|
|
11
|
+
import { buildCredentialSafeSubprocessEnv, buildUserSubprocessEnv, PLATFORM_ROUTER_BEARER_ENV, withoutPlatformRouterBearers, } from '../../utils/subprocess_env.js';
|
|
10
12
|
export const MAX_CODEX_APP_SERVER_FRAME_BYTES = 1_048_576;
|
|
11
13
|
export const MAX_CODEX_APP_SERVER_QUEUED_FRAMES = 1_024;
|
|
12
14
|
/** Keep managed profiles on their own auth.json and ChatGPT subscription. */
|
|
@@ -27,27 +29,104 @@ const MAX_CODEX_APP_SERVER_OBSERVATIONS_PER_TURN = 128;
|
|
|
27
29
|
const MAX_CODEX_APP_SERVER_MODEL_PAGES = 20;
|
|
28
30
|
const MAX_CODEX_APP_SERVER_MODELS = 2_000;
|
|
29
31
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*
|
|
32
|
+
* The stray auth overrides a codex app-server is never given: with one of them the codex CLI would bill an API key, or
|
|
33
|
+
* sign in some other way, instead of the account's ChatGPT subscription (auth.json under CODEX_HOME).
|
|
34
|
+
*/
|
|
35
|
+
const CODEX_AUTH_OVERRIDE_ENV = [
|
|
36
|
+
'OPENAI_API_KEY', 'OPENAI_BASE_URL', 'CODEX_ACCESS_TOKEN', 'CODEX_API_KEY',
|
|
37
|
+
'OPENAI_IDENTITY_TOKEN_FILE', 'OPENAI_FEDERATION_RULE_ID', 'CODEX_SQLITE_HOME',
|
|
38
|
+
];
|
|
39
|
+
/**
|
|
40
|
+
* What a Codex whose environment is allowlisted (config/hosted_runtime.ts codexEnvAllowlisted: its host runs ZTC, or
|
|
41
|
+
* asks for that alone) is given of its environment besides the names the bubblewrap sandbox gives a command
|
|
42
|
+
* (utils/subprocess_env.ts buildCredentialSafeSubprocessEnv: CI, COLORTERM, FORCE_COLOR, HOME, LANG, LOGNAME, NO_COLOR,
|
|
43
|
+
* PATH, SHELL, TEMP, TERM, TMP, TMPDIR, TZ, USER and LC_*): where its sign-in is (CODEX_HOME); the certificates a host's
|
|
44
|
+
* private CA or TLS-inspecting proxy is trusted with (CODEX_CA_CERTIFICATE and SSL_CERT_FILE, which the codex binary
|
|
45
|
+
* reads, SSL_CERT_DIR, NODE_EXTRA_CA_CERTS, which the npm package's node launcher and the node tools its commands run
|
|
46
|
+
* read, and GIT_SSL_CAINFO, CURL_CA_BUNDLE and REQUESTS_CA_BUNDLE, which git, curl and Python's requests read for the
|
|
47
|
+
* commands it runs); and the proxy it reaches OpenAI through (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY and NO_PROXY, and their
|
|
48
|
+
* lowercase forms, which the codex binary reads, as curl, and so git, does). Nothing else: no key (CODEX_AUTH_JSON is
|
|
49
|
+
* none of these), no bearer, and none of the rest of the host's environment.
|
|
50
|
+
*/
|
|
51
|
+
export const CODEX_APP_SERVER_HOSTED_ENV = Object.freeze([
|
|
52
|
+
'CODEX_HOME', 'CODEX_CA_CERTIFICATE', 'SSL_CERT_FILE', 'SSL_CERT_DIR', 'NODE_EXTRA_CA_CERTS',
|
|
53
|
+
'GIT_SSL_CAINFO', 'CURL_CA_BUNDLE', 'REQUESTS_CA_BUNDLE',
|
|
54
|
+
'HTTP_PROXY', 'HTTPS_PROXY', 'ALL_PROXY', 'NO_PROXY', 'http_proxy', 'https_proxy', 'all_proxy', 'no_proxy',
|
|
55
|
+
]);
|
|
56
|
+
/**
|
|
57
|
+
* Environment for the spawned `codex app-server`, pinned to the account's own credentials: the per-account CODEX_HOME
|
|
58
|
+
* (when given), and none of the stray auth overrides (CODEX_AUTH_OVERRIDE_ENV), even with no per-account home, so an
|
|
59
|
+
* ambient key never hijacks the default ChatGPT login.
|
|
60
|
+
*
|
|
61
|
+
* The app-server runs the commands Codex's model asks for with this environment, and every program its own git runs
|
|
62
|
+
* with it too: a work tree's filter driver (a clean filter a tracked .gitattributes selects and .git/config names), which
|
|
63
|
+
* codex leaves on for its git as it turns fsmonitor and hooks off, ran with it when the model's only command was `pwd`
|
|
64
|
+
* (E1 round 13). So, for every user, it starts from a user subprocess's (buildUserSubprocessEnv: none of ZTC's own
|
|
65
|
+
* credentials or its host's effort policy, under any name) without any ZergAI platform or Zerg Router bearer, whatever
|
|
66
|
+
* it holds, or another name for one (PLATFORM_ROUTER_BEARER_ENV): Codex never needs one. On the person's own computer the
|
|
67
|
+
* rest is theirs, their SSH agent and toolchains among it, which their builds and git need. Where Codex's environment is
|
|
68
|
+
* allowlisted (config/hosted_runtime.ts codexEnvAllowlisted: its host runs ZTC, as ZTC_HOSTED=1, a host's thread or
|
|
69
|
+
* ZTC_PERMISSION_PROFILE_PINNED says, or asks for that alone, with ZTC_CODEX_ENV_ALLOWLIST=1, as a ZergCloud zerg's
|
|
70
|
+
* entrypoint does) it is only the allowlisted names (buildCredentialSafeSubprocessEnv's, and
|
|
71
|
+
* CODEX_APP_SERVER_HOSTED_ENV): the rest of the host's environment reaches neither Codex nor anything it runs.
|
|
39
72
|
*/
|
|
40
73
|
export function buildCodexAppServerEnv(codexHome, base = process.env) {
|
|
41
|
-
const
|
|
74
|
+
const stripped = withoutPlatformRouterBearers(buildUserSubprocessEnv(base), base);
|
|
75
|
+
for (const name of CODEX_AUTH_OVERRIDE_ENV)
|
|
76
|
+
delete stripped[name];
|
|
77
|
+
const env = codexEnvAllowlisted(base) ? hostedCodexEnv(stripped) : stripped;
|
|
42
78
|
if (codexHome)
|
|
43
79
|
env.CODEX_HOME = codexHome;
|
|
44
|
-
for (const name of [
|
|
45
|
-
'OPENAI_API_KEY', 'OPENAI_BASE_URL', 'CODEX_ACCESS_TOKEN', 'CODEX_API_KEY',
|
|
46
|
-
'OPENAI_IDENTITY_TOKEN_FILE', 'OPENAI_FEDERATION_RULE_ID', 'CODEX_SQLITE_HOME',
|
|
47
|
-
])
|
|
48
|
-
delete env[name];
|
|
49
80
|
return env;
|
|
50
81
|
}
|
|
82
|
+
/** Of ENV, only what a Codex whose environment is allowlisted is given: the bubblewrap sandbox's names and CODEX_APP_SERVER_HOSTED_ENV. */
|
|
83
|
+
function hostedCodexEnv(env) {
|
|
84
|
+
const kept = buildCredentialSafeSubprocessEnv(env);
|
|
85
|
+
for (const name of CODEX_APP_SERVER_HOSTED_ENV) {
|
|
86
|
+
if (env[name] !== undefined)
|
|
87
|
+
kept[name] = env[name];
|
|
88
|
+
}
|
|
89
|
+
return kept;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* How ZTC starts a Codex pane (panes/agent_panes.ts openAgentPane: /codex, the chooser, the + menus, a resume, the
|
|
93
|
+
* workspace server's open_pane), over the environment its renderer gives each pane, SOURCE's, read as ZTC was started
|
|
94
|
+
* with it: it is given what the codex app-server is (buildCodexAppServerEnv), since Codex's own git runs a work tree's
|
|
95
|
+
* filter driver there too (E1 round 13). WITHHELD are the names the pane's environment blanks and its shell unsets
|
|
96
|
+
* before Codex starts:
|
|
97
|
+
*
|
|
98
|
+
* - for every user, every ZergAI platform and Zerg Router bearer (PLATFORM_ROUTER_BEARER_ENV), set or not, since a login
|
|
99
|
+
* file may export one, and every other variable of SOURCE holding one's value; the rest is the person's own, the
|
|
100
|
+
* sign-in methods their own Codex offers among it, since a pane runs on none of ZTC's accounts, where the app-server
|
|
101
|
+
* runs on the sign-in under its account's CODEX_HOME;
|
|
102
|
+
* - where Codex's environment is ALLOWLISTED (config/hosted_runtime.ts codexEnvAllowlisted), every name of SOURCE that
|
|
103
|
+
* the codex app-server isn't given there. Such a pane starts from no login shell, whose files are its host's, and with
|
|
104
|
+
* no workspace tools, whose pane relay would open a pane with the rest.
|
|
105
|
+
*/
|
|
106
|
+
export function codexPaneEnv(source = process.env) {
|
|
107
|
+
const launch = hostLaunchEnvironment(source);
|
|
108
|
+
const withoutBearers = withoutPlatformRouterBearers(launch, source);
|
|
109
|
+
const withheld = new Set([...PLATFORM_ROUTER_BEARER_ENV, ...Object.keys(launch).filter(name => withoutBearers[name] === undefined)]);
|
|
110
|
+
const allowlisted = codexEnvAllowlisted(source);
|
|
111
|
+
if (allowlisted) {
|
|
112
|
+
const given = buildCodexAppServerEnv(undefined, source);
|
|
113
|
+
for (const name of Object.keys(launch))
|
|
114
|
+
if (given[name] === undefined)
|
|
115
|
+
withheld.add(name);
|
|
116
|
+
}
|
|
117
|
+
return { allowlisted, withheld: [...withheld].sort() };
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* What a Codex request says where Codex's environment is allowlisted (codexEnvAllowlisted) and the app-server finds no
|
|
121
|
+
* sign-in under its CODEX_HOME. Every Codex with none is refused before a thread starts, so nothing was sent; there,
|
|
122
|
+
* nothing from the environment stands in for the sign-in, since the app-server is given no key (buildCodexAppServerEnv),
|
|
123
|
+
* and ZTC looks for none, so this says what its host does about it.
|
|
124
|
+
*/
|
|
125
|
+
export const CODEX_HOSTED_NO_SIGN_IN = 'codex_app_server has no sign-in in its CODEX_HOME, so nothing was sent. Where its host '
|
|
126
|
+
+ 'runs ZTC (ZTC_HOSTED, a host\'s thread, ZTC_PERMISSION_PROFILE_PINNED) or keeps Codex to the allowlisted environment '
|
|
127
|
+
+ '(ZTC_CODEX_ENV_ALLOWLIST), Codex runs only on the sign-in its CODEX_HOME holds and is given no key from the environment '
|
|
128
|
+
+ 'in its place (OPENAI_API_KEY, CODEX_API_KEY, CODEX_AUTH_JSON). The host signs Codex in there (CODEX_HOME=<folder> codex '
|
|
129
|
+
+ 'login), or runs this thread through Zerg Router.';
|
|
51
130
|
/** What ZTC answers a Codex server request it has no screen for. */
|
|
52
131
|
function unsupportedServerRequestMessage(method) {
|
|
53
132
|
const instead = method === 'item/tool/requestUserInput' ? ' Ask the person with the ask_user tool instead.' : '';
|
|
@@ -309,9 +388,10 @@ export class ChildProcessTransport {
|
|
|
309
388
|
}
|
|
310
389
|
constructor(command, args, env) {
|
|
311
390
|
// ENV is the child's whole environment, a per-account CODEX_HOME included (buildCodexAppServerEnv, which every
|
|
312
|
-
// backend passes). A caller that gives none gets
|
|
313
|
-
//
|
|
314
|
-
|
|
391
|
+
// backend passes). A caller that gives none gets the same, with no CODEX_HOME of its own, never all of process.env:
|
|
392
|
+
// the app-server runs the commands Codex's model asks for with it, so none of ZTC's credentials, no platform or
|
|
393
|
+
// Router bearer, and only the allowlisted names where Codex's environment is allowlisted.
|
|
394
|
+
this.child = spawn(command, args, { stdio: ['pipe', 'pipe', 'pipe'], env: env ?? buildCodexAppServerEnv() });
|
|
315
395
|
process.once('exit', this.reapOnExit);
|
|
316
396
|
this.child.stdout.on('data', (chunk) => {
|
|
317
397
|
if (this.stopping)
|
|
@@ -884,7 +964,9 @@ export class CodexAppServerClient {
|
|
|
884
964
|
async requireAccount(onActivity) {
|
|
885
965
|
const result = await this.readAccount(false, onActivity);
|
|
886
966
|
if (!result.account) {
|
|
887
|
-
|
|
967
|
+
// Where Codex's environment is allowlisted no key from the environment stands in for the sign-in: say what the host does.
|
|
968
|
+
throw new Error(codexEnvAllowlisted() ? CODEX_HOSTED_NO_SIGN_IN
|
|
969
|
+
: "codex_app_server is not logged in. Run 'codex login status' or 'codex login' before using ZTC's official Codex provider.");
|
|
888
970
|
}
|
|
889
971
|
if (this.requireChatGptSubscription
|
|
890
972
|
&& (result.account.type !== 'chatgpt' || result.requiresOpenaiAuth !== true)) {
|
|
@@ -128,17 +128,18 @@ export declare class ZRouterStreamBackend implements AgentBackend {
|
|
|
128
128
|
* (promptCacheTtl, as AnthropicBackend reads it, whose requests then carry no cache_control), for a route whose every
|
|
129
129
|
* provider is Anthropic. Router's translation to Anthropic's Messages API caches a system prompt of 1024 characters or
|
|
130
130
|
* more unless the body says so, and records a request carrying cache_control without a price, which a dollar limit
|
|
131
|
-
* counts at its whole hold.
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
131
|
+
* counts at its whole hold. A route plan of the turn's own that can fall back to another provider's model doesn't ask:
|
|
132
|
+
* a Router older than #903 handed that model's API the body as it came, the field included. Since #903 Router drops the
|
|
133
|
+
* field before any upstream, so a turn with no plan of its own asks and names no route, and the deck's or the
|
|
134
|
+
* workspace's stored plan, which ZTC can't see, applies as it does to any turn. Never on a Router and account that
|
|
135
|
+
* refused the field (refusedPromptCache).
|
|
135
136
|
*/
|
|
136
137
|
private asksNoPromptCache;
|
|
137
138
|
/**
|
|
138
|
-
* Whether Router refused REQUEST, whose body asked for no prompt cache, for a field its account doesn't take, as
|
|
139
|
-
* service-account key's allowlist
|
|
140
|
-
*
|
|
141
|
-
*
|
|
139
|
+
* Whether Router refused REQUEST, whose body asked for no prompt cache, for a field its account doesn't take, as an
|
|
140
|
+
* older Router's service-account key's allowlist refused prompt_cache: then that Router and account get the field no
|
|
141
|
+
* more (promptCacheRefused), which the runtime diagnostics say once, and the caller sends the request once more without
|
|
142
|
+
* it.
|
|
142
143
|
*/
|
|
143
144
|
private refusedPromptCache;
|
|
144
145
|
/**
|
|
@@ -100,8 +100,8 @@ function toolImagesRefusal(key) {
|
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
102
|
* What Router answers a service-account key's request carrying a field the account's allowlist doesn't name
|
|
103
|
-
* (zapps/zergrouter/server/lib/service-accounts.ts, serviceRequestQuote):
|
|
104
|
-
*
|
|
103
|
+
* (zapps/zergrouter/server/lib/service-accounts.ts, serviceRequestQuote): a Router older than #903 named no
|
|
104
|
+
* `prompt_cache`, which a Router since then takes.
|
|
105
105
|
*/
|
|
106
106
|
const UNSUPPORTED_SERVICE_OPTION = 'Unsupported service inference option';
|
|
107
107
|
/** Whether ERROR is Router's 400 for a field of the request a service-account key doesn't take, in any of its envelopes. */
|
|
@@ -117,9 +117,9 @@ function unsupportedServiceOption(error) {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
120
|
-
* The Routers and accounts that refused `prompt_cache` (
|
|
121
|
-
* them carries it again in this process, from any backend. Kept beside the backends, since a host effort
|
|
122
|
-
* one per turn.
|
|
120
|
+
* The Routers and accounts that refused `prompt_cache` (an older Router's service-account key's allowlist didn't take it):
|
|
121
|
+
* no request to them carries it again in this process, from any backend. Kept beside the backends, since a host effort
|
|
122
|
+
* policy builds one per turn.
|
|
123
123
|
*/
|
|
124
124
|
const promptCacheRefused = new Set();
|
|
125
125
|
/**
|
|
@@ -464,20 +464,21 @@ export class ZRouterStreamBackend {
|
|
|
464
464
|
* (promptCacheTtl, as AnthropicBackend reads it, whose requests then carry no cache_control), for a route whose every
|
|
465
465
|
* provider is Anthropic. Router's translation to Anthropic's Messages API caches a system prompt of 1024 characters or
|
|
466
466
|
* more unless the body says so, and records a request carrying cache_control without a price, which a dollar limit
|
|
467
|
-
* counts at its whole hold.
|
|
468
|
-
*
|
|
469
|
-
*
|
|
470
|
-
*
|
|
467
|
+
* counts at its whole hold. A route plan of the turn's own that can fall back to another provider's model doesn't ask:
|
|
468
|
+
* a Router older than #903 handed that model's API the body as it came, the field included. Since #903 Router drops the
|
|
469
|
+
* field before any upstream, so a turn with no plan of its own asks and names no route, and the deck's or the
|
|
470
|
+
* workspace's stored plan, which ZTC can't see, applies as it does to any turn. Never on a Router and account that
|
|
471
|
+
* refused the field (refusedPromptCache).
|
|
471
472
|
*/
|
|
472
473
|
asksNoPromptCache(request) {
|
|
473
474
|
return promptCacheTtl() === 'off' && this.routeProviders(request).every(provider => provider === 'anthropic')
|
|
474
475
|
&& !promptCacheRefused.has(this.promptCacheKey(request));
|
|
475
476
|
}
|
|
476
477
|
/**
|
|
477
|
-
* Whether Router refused REQUEST, whose body asked for no prompt cache, for a field its account doesn't take, as
|
|
478
|
-
* service-account key's allowlist
|
|
479
|
-
*
|
|
480
|
-
*
|
|
478
|
+
* Whether Router refused REQUEST, whose body asked for no prompt cache, for a field its account doesn't take, as an
|
|
479
|
+
* older Router's service-account key's allowlist refused prompt_cache: then that Router and account get the field no
|
|
480
|
+
* more (promptCacheRefused), which the runtime diagnostics say once, and the caller sends the request once more without
|
|
481
|
+
* it.
|
|
481
482
|
*/
|
|
482
483
|
refusedPromptCache(request, error) {
|
|
483
484
|
if (!unsupportedServiceOption(error))
|
|
@@ -486,7 +487,7 @@ export class ZRouterStreamBackend {
|
|
|
486
487
|
if (!promptCacheRefused.has(key)) {
|
|
487
488
|
promptCacheRefused.add(key);
|
|
488
489
|
runtimeDiag('warn', `[ztc] Zerg Router at ${this.proxyUrl} refused a request asking it for no prompt cache (prompt_cache: false, `
|
|
489
|
-
+ `sent under ZTC_PROMPT_CACHE_TTL=off) with 400 "${UNSUPPORTED_SERVICE_OPTION}", as a service-account key
|
|
490
|
+
+ `sent under ZTC_PROMPT_CACHE_TTL=off) with 400 "${UNSUPPORTED_SERVICE_OPTION}", as an older Router does for a service-account key, `
|
|
490
491
|
+ 'so ZTC sent it again without the field and sends that Router none on this key for the rest of the run. Router then caches '
|
|
491
492
|
+ 'a Claude model\'s long system prompt, as it does by default.');
|
|
492
493
|
}
|
|
@@ -606,8 +607,7 @@ export class ZRouterStreamBackend {
|
|
|
606
607
|
* what the route takes as one. WITHOUT_TOOL_IMAGES sends none, as a request Router refused for them goes again.
|
|
607
608
|
*/
|
|
608
609
|
buildOpenAIBody(request, withoutToolImages, sent = TOOL_IMAGE_BUDGET) {
|
|
609
|
-
const
|
|
610
|
-
const promptCache = noPromptCache ? { prompt_cache: false } : {};
|
|
610
|
+
const promptCache = this.asksNoPromptCache(request) ? { prompt_cache: false } : {};
|
|
611
611
|
if (this.catalog?.version === 1) {
|
|
612
612
|
const descriptor = resolveRouterModel(this.catalog, this.provider, request.model);
|
|
613
613
|
if (!descriptor?.capabilities?.chat)
|
|
@@ -641,9 +641,8 @@ export class ZRouterStreamBackend {
|
|
|
641
641
|
provider: descriptor.owned_by, model: `${descriptor.id}${variant}`,
|
|
642
642
|
...(routing ? { openrouter: routing } : {}),
|
|
643
643
|
// With no plan Router takes the deck's or the workspace's stored default plan, whose fallbacks ZTC can't see and
|
|
644
|
-
// which gets each the same body: a request carrying tool images
|
|
645
|
-
|
|
646
|
-
...(request.routePlan ? { route: request.routePlan } : carriesToolImages || noPromptCache ? { route: { allow_fallbacks: false } } : {}),
|
|
644
|
+
// which gets each the same body: a request carrying tool images says it has none, so they reach its model alone.
|
|
645
|
+
...(request.routePlan ? { route: request.routePlan } : carriesToolImages ? { route: { allow_fallbacks: false } } : {}),
|
|
647
646
|
...(outputLimit === undefined ? {} : { max_output_tokens: outputLimit }),
|
|
648
647
|
...(caps.reasoning && request.codexEffort ? { reasoning_effort: request.codexEffort } : {}),
|
|
649
648
|
...promptCache,
|
|
@@ -681,8 +680,7 @@ export class ZRouterStreamBackend {
|
|
|
681
680
|
return { carriesToolImages: false, body: {
|
|
682
681
|
provider: this.provider,
|
|
683
682
|
model: request.model,
|
|
684
|
-
|
|
685
|
-
...(request.routePlan ? { route: request.routePlan } : noPromptCache ? { route: { allow_fallbacks: false } } : {}),
|
|
683
|
+
...(request.routePlan ? { route: request.routePlan } : {}),
|
|
686
684
|
...tokenParam,
|
|
687
685
|
...(request.codexEffort && modelContract(this.provider, request.model, 'chat_tools')?.reasoningEfforts.includes(request.codexEffort)
|
|
688
686
|
? { reasoning_effort: request.codexEffort } : {}),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { describeExecutionContext } from '../runtime/execution_context.js';
|
|
2
2
|
import { PERMISSION_PIN_ENV } from '../../config/permission_pin.js';
|
|
3
3
|
import { projectPermissionPolicy } from '../../config/permissions.js';
|
|
4
|
+
import { bubblewrapMakesNamespaces } from '../../utils/sandbox.js';
|
|
4
5
|
import { formatRuntimeSummary, getRuntimeInfo } from '../../runtime_info.js';
|
|
5
6
|
import { getWorkflowRegistry } from '../../workflows/registry_handle.js';
|
|
6
7
|
import { workflowsEnabled, workflowNaturalLanguageTriggerEnabled } from '../../workflows/config.js';
|
|
@@ -8,17 +9,21 @@ import { connectionStatusLines, describeActiveRoute, readinessLine } from './cre
|
|
|
8
9
|
/**
|
|
9
10
|
* What the agent runs under, for /status: the permission profile's id, said pinned where its host pinned the permission
|
|
10
11
|
* settings (ZTC_PERMISSION_PROFILE_PINNED), and whether its commands must run in the OS sandbox and whether one enforces
|
|
11
|
-
* them here, with which backend
|
|
12
|
-
*
|
|
12
|
+
* them here, with which backend: bubblewrap only where it makes the namespaces ZTC runs commands in, not wherever bwrap is
|
|
13
|
+
* on PATH (bubblewrapMakesNamespaces). Never the profile's definition (its file roots, its capabilities): /permissions
|
|
14
|
+
* shows that, and /status --verbose leaves it out of the agent's execution facts, which held it (describeExecutionContext).
|
|
13
15
|
*/
|
|
14
16
|
function permissionStatusLines(config, ctx) {
|
|
15
17
|
const policy = projectPermissionPolicy(config);
|
|
16
18
|
const sandbox = policy.commandSandbox;
|
|
17
19
|
const pinned = ctx.config.permissionPinRefusal?.() ? `, pinned by its host (${PERMISSION_PIN_ENV})` : '';
|
|
18
20
|
const enforced = !sandbox.requested ? 'none is used'
|
|
19
|
-
: sandbox.available && sandbox.enforcement === 'os'
|
|
20
|
-
:
|
|
21
|
-
|
|
21
|
+
: sandbox.available && sandbox.enforcement === 'os' && sandbox.backend === 'bubblewrap' && !bubblewrapMakesNamespaces()
|
|
22
|
+
? 'not enforced: bubblewrap is installed, but can\'t make the namespaces ZTC runs commands in here (the host must let this '
|
|
23
|
+
+ 'user create user namespaces), so commands fail'
|
|
24
|
+
: sandbox.available && sandbox.enforcement === 'os' ? `enforced by ${sandbox.backend}`
|
|
25
|
+
: sandbox.available && sandbox.enforcement === 'partial' ? `partly enforced by ${sandbox.backend}`
|
|
26
|
+
: `not enforced: no OS sandbox on this host${sandbox.required ? ', so commands don\'t run' : ''}`;
|
|
22
27
|
return [
|
|
23
28
|
` Permission profile: ${policy.id}${pinned}`,
|
|
24
29
|
` OS command sandbox: ${sandbox.required ? 'required' : 'not required'}${sandbox.requested ? '; ' : ', and '}${enforced}`,
|
|
@@ -69,6 +69,8 @@ export interface ConfigController {
|
|
|
69
69
|
* host pinned them (ZTC_PERMISSION_PROFILE_PINNED; ConfigStore.permissionPinRefusal).
|
|
70
70
|
*/
|
|
71
71
|
permissionPinRefusal?: () => string | undefined;
|
|
72
|
+
/** Why this ZTC doesn't update itself, or undefined when it may: its host pinned its permission settings (ConfigStore.selfUpdateRefusal). */
|
|
73
|
+
selfUpdateRefusal?: () => string | undefined;
|
|
72
74
|
switchProfile?: (name: string, activate: () => void | Promise<void>) => Promise<void>;
|
|
73
75
|
hasApiKey: () => boolean;
|
|
74
76
|
getApiKey: (provider?: string) => string | undefined;
|
|
@@ -50,6 +50,12 @@ export function createUpdateCommand(deps) {
|
|
|
50
50
|
description: 'Check for updates and install the latest version',
|
|
51
51
|
usage: '/update [--check]',
|
|
52
52
|
handler: async (args, ctx) => {
|
|
53
|
+
// A ZTC its host pins (ZTC_PERMISSION_PROFILE_PINNED) is updated by its host, not by itself.
|
|
54
|
+
const pinned = ctx.config.selfUpdateRefusal?.();
|
|
55
|
+
if (pinned) {
|
|
56
|
+
ctx.addMessage({ role: 'system', content: pinned });
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
53
59
|
if (deps.desktopBundle()) {
|
|
54
60
|
ctx.addMessage({ role: 'system', content: DESKTOP_UPDATE_MESSAGE });
|
|
55
61
|
return;
|
|
@@ -116,6 +116,8 @@ export async function runCPUWorkload(workload, context) {
|
|
|
116
116
|
child.on('close', code => {
|
|
117
117
|
clearTimeout(timer);
|
|
118
118
|
context.signal?.removeEventListener('abort', cancel);
|
|
119
|
+
// What the plan made for the run (its policy files, the folders bwrap stood placeholders on), gone with it.
|
|
120
|
+
plan.cleanup?.();
|
|
119
121
|
resolve({ outcome: outcome ?? (code === 0 ? 'passed' : 'failed'), output, executionPolicyId });
|
|
120
122
|
});
|
|
121
123
|
if (context.signal?.aborted)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Tool, ToolContext } from '../tools/types.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type Policy } from './policy.js';
|
|
3
3
|
import { ToolCapability } from './capabilities.js';
|
|
4
4
|
import { HookDispatcher } from '../../hooks/dispatcher.js';
|
|
5
5
|
import type { HookApprovalRequester } from '../../hooks/types.js';
|
|
@@ -2,6 +2,7 @@ import { basename, dirname, join, relative, resolve } from 'path';
|
|
|
2
2
|
import { realpathSync } from 'node:fs';
|
|
3
3
|
import { appendFile } from 'node:fs/promises';
|
|
4
4
|
import { getRuntimeCapabilities } from '../tools/helper_requirements.js';
|
|
5
|
+
import { startsProgramsOutsideSandbox } from './policy.js';
|
|
5
6
|
import { ToolCapability } from './capabilities.js';
|
|
6
7
|
import { capToolResult } from './result_cap.js';
|
|
7
8
|
import { configStore } from '../../config.js';
|
|
@@ -208,6 +209,9 @@ export async function executeToolWithRuntime(name, args, options) {
|
|
|
208
209
|
// Whether the call starts nothing of the agent's outside run_command's OS sandbox (Tool.confinedCommands). ztc_command
|
|
209
210
|
// runs no program itself: a command that does declares it (ztcCommandConfined), and that call is judged by it.
|
|
210
211
|
const confinedCall = (input) => (sourceTool === ztcCommandTool ? ztcCommandConfined(input) : tool?.confinedCommands === true);
|
|
212
|
+
/** What an approval request for the call says of where it starts programs (HookApprovalRequest.startsProgramsOutsideSandbox). */
|
|
213
|
+
const outsideSandbox = (input) => (startsProgramsOutsideSandbox(callCapabilities(input), { sandboxedCommands: tool?.sandboxedCommands, confinedCommands: confinedCall(input) })
|
|
214
|
+
? { startsProgramsOutsideSandbox: true } : {});
|
|
211
215
|
let capabilities = requiredCapabilities(args);
|
|
212
216
|
let effectiveArgs = args;
|
|
213
217
|
let approvalGranted = false;
|
|
@@ -296,6 +300,7 @@ export async function executeToolWithRuntime(name, args, options) {
|
|
|
296
300
|
args: effectiveArgs,
|
|
297
301
|
capabilities: capabilities,
|
|
298
302
|
reason: preHook.decisionReason,
|
|
303
|
+
...outsideSandbox(effectiveArgs),
|
|
299
304
|
});
|
|
300
305
|
if (!approval.approved) {
|
|
301
306
|
return {
|
|
@@ -464,6 +469,7 @@ export async function executeToolWithRuntime(name, args, options) {
|
|
|
464
469
|
args: effectiveArgs,
|
|
465
470
|
capabilities: capabilities,
|
|
466
471
|
reason,
|
|
472
|
+
...outsideSandbox(effectiveArgs),
|
|
467
473
|
});
|
|
468
474
|
if (!approval.approved) {
|
|
469
475
|
return {
|
|
@@ -566,6 +572,7 @@ export async function executeToolWithRuntime(name, args, options) {
|
|
|
566
572
|
args: effectiveArgs,
|
|
567
573
|
capabilities: capabilities,
|
|
568
574
|
reason: `Host approval is required for ${capabilities.join(', ')}`,
|
|
575
|
+
...outsideSandbox(effectiveArgs),
|
|
569
576
|
});
|
|
570
577
|
if (!approval.approved) {
|
|
571
578
|
return {
|
package/dist/agent/tools/ml.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Uses a singleton MlNative instance that starts on first use
|
|
6
6
|
* and stays alive for the session.
|
|
7
7
|
*/
|
|
8
|
+
import { resolve } from 'path';
|
|
8
9
|
import { ToolCapability } from '../runtime/capabilities.js';
|
|
9
10
|
import { MlNative, isMlNativeAvailable } from '../../utils/ml_native.js';
|
|
10
11
|
// Singleton MlNative instance — lazily started
|
|
@@ -25,9 +26,32 @@ export function shutdownMl() {
|
|
|
25
26
|
mlInstance = null;
|
|
26
27
|
}
|
|
27
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* What each ML tool declares. It starts ZTC's native ML helper, which runs outside any OS sandbox and opens the files a call
|
|
31
|
+
* names (utils/ml_native.ts), so a profile that runs no command, writes nothing, or runs the agent's commands only inside
|
|
32
|
+
* an OS sandbox neither offers nor admits these tools (startsProgramsOutsideSandbox), and one that asks before each command
|
|
33
|
+
* asks, as for the LSP and routine tools. Declaring only ml_inference let ml_train save weights wherever the agent named,
|
|
34
|
+
* ZTC's own state included (the reviewer's recheck of round 2, RC2-7).
|
|
35
|
+
*/
|
|
36
|
+
function mlCapabilities() {
|
|
37
|
+
return [ToolCapability.ML_INFERENCE, ToolCapability.SHELL_EXEC];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* ARGS's file argument NAME, as the helper is handed it: resolved against the agent's folder, which the runtime admits as
|
|
41
|
+
* read_file's or write_file's path before the call runs (Tool.readPaths, Tool.writePaths). Throws where it is missing or
|
|
42
|
+
* not text, as the call would.
|
|
43
|
+
*/
|
|
44
|
+
function mlFile(args, name, toolName, context) {
|
|
45
|
+
const value = args[name];
|
|
46
|
+
if (typeof value !== 'string' || value.trim().length === 0) {
|
|
47
|
+
throw new Error(`${toolName}: required argument \`${name}\` is missing or not a path.`);
|
|
48
|
+
}
|
|
49
|
+
return resolve(context?.cwd || process.cwd(), value);
|
|
50
|
+
}
|
|
28
51
|
// --- Tools ---
|
|
29
52
|
export const mlLoadModelTool = {
|
|
30
|
-
capabilities:
|
|
53
|
+
capabilities: mlCapabilities(),
|
|
54
|
+
readPaths: (args, context) => [mlFile(args, 'weights_path', 'ml_load_model', context)],
|
|
31
55
|
definition: {
|
|
32
56
|
name: 'ml_load_model',
|
|
33
57
|
description: 'Load an ML model from a safetensors weights file. Must be called before running inference.',
|
|
@@ -54,11 +78,11 @@ export const mlLoadModelTool = {
|
|
|
54
78
|
required: ['weights_path']
|
|
55
79
|
}
|
|
56
80
|
},
|
|
57
|
-
execute: async (args) => {
|
|
81
|
+
execute: async (args, context) => {
|
|
58
82
|
if (!isMlNativeAvailable()) {
|
|
59
83
|
throw new Error('ztc-ml binary not available. Build with: cd packages/ztc-ml && cargo build --release');
|
|
60
84
|
}
|
|
61
|
-
const weightsPath =
|
|
85
|
+
const weightsPath = mlFile(args, 'weights_path', 'ml_load_model', context);
|
|
62
86
|
const config = {
|
|
63
87
|
image_width: args.image_width !== undefined ? Number(args.image_width) : undefined,
|
|
64
88
|
image_height: args.image_height !== undefined ? Number(args.image_height) : undefined,
|
|
@@ -73,7 +97,7 @@ export const mlLoadModelTool = {
|
|
|
73
97
|
}
|
|
74
98
|
};
|
|
75
99
|
export const mlInferTool = {
|
|
76
|
-
capabilities:
|
|
100
|
+
capabilities: mlCapabilities(),
|
|
77
101
|
definition: {
|
|
78
102
|
name: 'ml_infer',
|
|
79
103
|
description: 'Run ML inference on a PNG image (base64 encoded). Returns per-action probabilities. A model must be loaded first with ml_load_model.',
|
|
@@ -112,7 +136,10 @@ export const mlInferTool = {
|
|
|
112
136
|
}
|
|
113
137
|
};
|
|
114
138
|
export const mlTrainTool = {
|
|
115
|
-
capabilities:
|
|
139
|
+
capabilities: mlCapabilities(),
|
|
140
|
+
readPaths: (args, context) => [mlFile(args, 'data_path', 'ml_train', context)],
|
|
141
|
+
writePaths: async (args, context) => args.save_weights_path === undefined ? []
|
|
142
|
+
: [{ path: mlFile(args, 'save_weights_path', 'ml_train', context), label: `save_weights_path ${String(args.save_weights_path)}` }],
|
|
116
143
|
definition: {
|
|
117
144
|
name: 'ml_train',
|
|
118
145
|
description: 'Start a training run on session data. Emits progress events. Training data should be a directory with events.jsonl and session.json.',
|
|
@@ -143,16 +170,16 @@ export const mlTrainTool = {
|
|
|
143
170
|
required: ['data_path']
|
|
144
171
|
}
|
|
145
172
|
},
|
|
146
|
-
execute: async (args) => {
|
|
173
|
+
execute: async (args, context) => {
|
|
147
174
|
if (!isMlNativeAvailable()) {
|
|
148
175
|
throw new Error('ztc-ml binary not available.');
|
|
149
176
|
}
|
|
150
|
-
const dataPath =
|
|
177
|
+
const dataPath = mlFile(args, 'data_path', 'ml_train', context);
|
|
151
178
|
const config = {
|
|
152
179
|
epochs: args.epochs !== undefined ? Number(args.epochs) : undefined,
|
|
153
180
|
batchSize: args.batch_size !== undefined ? Number(args.batch_size) : undefined,
|
|
154
181
|
learningRate: args.learning_rate !== undefined ? Number(args.learning_rate) : undefined,
|
|
155
|
-
saveWeightsPath: args.save_weights_path !== undefined ?
|
|
182
|
+
saveWeightsPath: args.save_weights_path !== undefined ? mlFile(args, 'save_weights_path', 'ml_train', context) : undefined,
|
|
156
183
|
};
|
|
157
184
|
const ml = getMl();
|
|
158
185
|
// Start training and wait for completion or first progress
|
|
@@ -179,7 +206,7 @@ export const mlTrainTool = {
|
|
|
179
206
|
}
|
|
180
207
|
};
|
|
181
208
|
export const mlStatusTool = {
|
|
182
|
-
capabilities:
|
|
209
|
+
capabilities: mlCapabilities(),
|
|
183
210
|
definition: {
|
|
184
211
|
name: 'ml_status',
|
|
185
212
|
description: 'Get the current status of the ML system: device, loaded model, availability.',
|