flowviant 0.125.3 → 0.125.4
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/bin/lib/postureTools.mjs +4 -0
- package/bin/lib/projectTools.mjs +32 -6
- package/package.json +1 -1
package/bin/lib/postureTools.mjs
CHANGED
|
@@ -45,6 +45,10 @@ const SUPPORTING_CAPABILITIES = `The kind defines the delivered product, not whi
|
|
|
45
45
|
may be used. Use available tools needed for the person's request, including
|
|
46
46
|
native image generation for requested textures or illustrations. A listed skill
|
|
47
47
|
is not proof that its tool is installed, mounted or entitled on this account.
|
|
48
|
+
Configuration and mount names do not prove a live MCP connection. Verify access
|
|
49
|
+
with a non-mutating tool before claiming it works. If a call fails, relay its
|
|
50
|
+
actual startup, approval or connection error and a concrete corrective step;
|
|
51
|
+
an empty instance list means no connected instances, not missing tools.
|
|
48
52
|
Do not re-file the kind or require a separate image card just to use a tool.
|
|
49
53
|
If a needed tool is absent or fails, relay the measured limitation and ask for
|
|
50
54
|
the missing configuration or a decision. A separately billed CLI/API fallback
|
package/bin/lib/projectTools.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Repo-owned tool configuration, read from the base ref for every agent turn. */
|
|
2
2
|
import { accessSync, constants, mkdirSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { delimiter, dirname, isAbsolute, join, resolve } from 'node:path';
|
|
3
|
+
import { delimiter, dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
4
4
|
import { tmpdir } from 'node:os';
|
|
5
5
|
import { git, gitRaw, splitNul } from './git.mjs';
|
|
6
6
|
import { withoutMachineCredentials } from './machineEnv.mjs';
|
|
@@ -36,6 +36,19 @@ function onPath(command, env) {
|
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
const relativeCommand = (command) => !isAbsolute(command) && command.includes('/');
|
|
40
|
+
|
|
41
|
+
/** Repo launchers are not PATH commands. Measure the reviewed tree's mode,
|
|
42
|
+
* never an uncommitted executable in the checkout used to read that tree. */
|
|
43
|
+
function reviewedExecutable(root, commit, command) {
|
|
44
|
+
const path = relative(resolve(root), resolve(root, command));
|
|
45
|
+
if (!path || path === '..' || path.startsWith('../') || isAbsolute(path)) return false;
|
|
46
|
+
try {
|
|
47
|
+
return splitNul(gitRaw(['ls-tree', '-z', commit, '--', path], root, SHOW))
|
|
48
|
+
.some((entry) => entry.startsWith('100755 blob ') && entry.slice(entry.indexOf('\t') + 1) === path);
|
|
49
|
+
} catch { return false; }
|
|
50
|
+
}
|
|
51
|
+
|
|
39
52
|
function referenced(value) {
|
|
40
53
|
return [...String(value).matchAll(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g)].map((m) => m[1]);
|
|
41
54
|
}
|
|
@@ -101,9 +114,14 @@ export function readBaseTools(root, ref, callerEnv = process.env) {
|
|
|
101
114
|
for (const key of referenced(value)) vars.add(key);
|
|
102
115
|
}
|
|
103
116
|
const missing = [...vars].filter((key) => !env[key]).sort();
|
|
104
|
-
const
|
|
117
|
+
const command = typeof config.command === 'string' ? expand(config.command, env) : null;
|
|
118
|
+
const repoCommand = command != null && relativeCommand(command);
|
|
119
|
+
const commandMissing = command != null && !(repoCommand ? reviewedExecutable(root, commit, command) : onPath(command, env));
|
|
105
120
|
const unsupported = typeof config.command !== 'string' && typeof config.url !== 'string';
|
|
106
|
-
const reason = missing.length ? `env ${missing.join(', ')} unset` : commandMissing
|
|
121
|
+
const reason = missing.length ? `env ${missing.join(', ')} unset` : commandMissing
|
|
122
|
+
? repoCommand ? `command ${config.command} is not an executable file in the base branch; commit the launcher with executable permission on base`
|
|
123
|
+
: `command ${config.command} not on PATH`
|
|
124
|
+
: unsupported ? 'MCP configuration unsupported' : null;
|
|
107
125
|
return { name, config, state: reason ? 'missing' : 'ready', reason };
|
|
108
126
|
});
|
|
109
127
|
// Nested instructions are normally discovered when a CLI enters that path.
|
|
@@ -119,7 +137,7 @@ export function readBaseTools(root, ref, callerEnv = process.env) {
|
|
|
119
137
|
if (instructionBytes > MAX_INSTRUCTION_BYTES) throw new Error('Base branch agent instructions exceed the turn limit');
|
|
120
138
|
instructions.push({ path, body });
|
|
121
139
|
}
|
|
122
|
-
return { tools, skills, skillFiles, instructions };
|
|
140
|
+
return { tools, skills, skillFiles, instructions, root: resolve(root) };
|
|
123
141
|
}
|
|
124
142
|
|
|
125
143
|
const expand = (value, env) => String(value).replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_, key) => env[key] ?? '');
|
|
@@ -144,6 +162,11 @@ export function prepareAgentTools(snapshot, runner, callerEnv = process.env, wor
|
|
|
144
162
|
const env = expansionEnv(callerEnv);
|
|
145
163
|
const dir = mkdtempSync(join(tmpdir(), 'flowviant-agent-tools-'));
|
|
146
164
|
const usable = snapshot.tools.filter((t) => t.state === 'ready' && mcpRefusal(runner, t.config) == null);
|
|
165
|
+
// The CLI may read its config from a temporary directory, and Codex research
|
|
166
|
+
// changes cwd to an isolated copy. Keep repository launchers rooted at the
|
|
167
|
+
// agent worktree, not either of those directories or the daemon's checkout.
|
|
168
|
+
const launchRoot = worktree ?? snapshot.root;
|
|
169
|
+
const launchCommand = (command) => launchRoot && relativeCommand(command) ? resolve(launchRoot, command) : command;
|
|
147
170
|
// What the base lists and this turn cannot mount, and why — the turn is told
|
|
148
171
|
// (postureTools.mjs), so a missing server is a named fact, never a guess.
|
|
149
172
|
const mcpUnmounted = snapshot.tools
|
|
@@ -152,7 +175,7 @@ export function prepareAgentTools(snapshot, runner, callerEnv = process.env, wor
|
|
|
152
175
|
const mcpServers = {};
|
|
153
176
|
for (const { name, config } of usable) {
|
|
154
177
|
if (typeof config.command === 'string') {
|
|
155
|
-
const command = expand(config.command, env);
|
|
178
|
+
const command = launchCommand(expand(config.command, env));
|
|
156
179
|
const args = Array.isArray(config.args) ? config.args.map((v) => expand(v, env)) : [];
|
|
157
180
|
const vars = Object.fromEntries(Object.entries(config.env ?? {}).map(([k, v]) => [k, expand(v, env)]));
|
|
158
181
|
mcpServers[name] = { command, args, env: vars };
|
|
@@ -191,7 +214,10 @@ export function prepareAgentTools(snapshot, runner, callerEnv = process.env, wor
|
|
|
191
214
|
mcpUnmounted,
|
|
192
215
|
/** The mount a fenced turn takes where the runner's file is ignored
|
|
193
216
|
* (`fencedMountFor`, projectToolRuntimes.mjs); null where it has none. */
|
|
194
|
-
fencedMount: fencedMountFor(runner, usable
|
|
217
|
+
fencedMount: fencedMountFor(runner, usable.map((entry) => ({ ...entry, config: {
|
|
218
|
+
...entry.config,
|
|
219
|
+
...(typeof entry.config.command === 'string' ? { command: launchCommand(entry.config.command) } : {}),
|
|
220
|
+
} })), (value) => expand(value, env), callerEnv),
|
|
195
221
|
instructions,
|
|
196
222
|
pluginDir,
|
|
197
223
|
codexHome,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowviant",
|
|
3
|
-
"version": "0.125.
|
|
3
|
+
"version": "0.125.4",
|
|
4
4
|
"description": "Run your own coding CLIs as build agents for Flowviant \u2014 Claude Code, Codex or Antigravity, on your own credentials. Holds your sessions, keeps a worktree per tab, and ships branches on your word.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|