@bridgebrew/sessions 0.0.7 → 0.0.8
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/package.json +1 -1
- package/server.ts +7 -2
package/package.json
CHANGED
package/server.ts
CHANGED
|
@@ -888,12 +888,16 @@ const unwoken = ({ wokeAt: _at, ...rest }: Session): Session => rest;
|
|
|
888
888
|
const imagesLabel = (attachments: { name: string }[]) =>
|
|
889
889
|
attachments.length === 1 ? `Image: ${attachments[0]!.name}` : `${attachments.length} images`;
|
|
890
890
|
|
|
891
|
+
/** Under the desktop app, `process.execPath` is the app's own binary: it runs the CLI only as Node
|
|
892
|
+
* (`ELECTRON_RUN_AS_NODE`), which an agent's processes do not inherit (the host's guard keeps it from them). */
|
|
893
|
+
const asNode = () => process.versions.electron !== undefined;
|
|
894
|
+
|
|
891
895
|
/** The `bridge` command on workspace `slug`, with absolute paths: the host gives its workers `BRIDGE_HOST_CLI` and
|
|
892
896
|
* `BRIDGE_HOST_ROOT`, but an agent's shell may not get them (Hermes keeps only its own allowlist). */
|
|
893
897
|
const bridgeCommand = (slug: string) => {
|
|
894
898
|
const { BRIDGE_HOST_CLI: cli, BRIDGE_HOST_ROOT: root } = process.env;
|
|
895
899
|
return cli && root
|
|
896
|
-
?
|
|
900
|
+
? `${asNode() ? 'ELECTRON_RUN_AS_NODE=1 ' : ''}"${process.execPath}" "${cli}" --root "${root}" --workspace ${slug}`
|
|
897
901
|
: `bridge --workspace ${slug}`;
|
|
898
902
|
};
|
|
899
903
|
|
|
@@ -966,10 +970,11 @@ const mcpServers = (slug: string, token?: string, worktree?: string) => {
|
|
|
966
970
|
name: 'bridge',
|
|
967
971
|
command: process.execPath,
|
|
968
972
|
args: [cli, 'mcp', '--root', root, '--workspace', worktree ?? slug],
|
|
969
|
-
...((token !== undefined || worktree !== undefined) && {
|
|
973
|
+
...((token !== undefined || worktree !== undefined || asNode()) && {
|
|
970
974
|
env: {
|
|
971
975
|
...(token !== undefined && { BRIDGE_MCP_TOKEN: token }),
|
|
972
976
|
...(worktree !== undefined && { BRIDGE_MCP_PARENT: slug }),
|
|
977
|
+
...(asNode() && { ELECTRON_RUN_AS_NODE: '1' }),
|
|
973
978
|
},
|
|
974
979
|
}),
|
|
975
980
|
approved: UNASKED_TOOLS,
|