@zaferyalcin/agent-office 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +476 -2
- package/bin/agent-office.js +64 -0
- package/package.json +25 -4
- package/public/app.css +1035 -0
- package/public/app.js +2034 -0
- package/public/favicon.svg +1 -0
- package/public/i18n.js +1119 -0
- package/public/index.html +141 -0
- package/public/studio.js +1951 -0
- package/public/vendor/three/LICENSE +21 -0
- package/public/vendor/three/three.core.js +61162 -0
- package/public/vendor/three/three.module.js +19537 -0
- package/src/collector.js +501 -0
- package/src/history.js +161 -0
- package/src/open.js +57 -0
- package/src/providers/antigravity-core.js +743 -0
- package/src/providers/antigravity.js +136 -0
- package/src/providers/claude-code.js +465 -0
- package/src/providers/codex.js +168 -0
- package/src/providers/demo.js +1379 -0
- package/src/providers/gemini-cli.js +115 -0
- package/src/server.js +201 -0
- package/src/state.js +142 -0
- package/src/update.js +99 -0
- package/src/util.js +139 -0
- package/src/workspace.js +112 -0
package/src/open.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// Opens an existing folder in the OS file manager or in a terminal window.
|
|
3
|
+
// Always spawns executables directly with argv arrays (never builds a shell command string from the path).
|
|
4
|
+
const childProcess = require('child_process');
|
|
5
|
+
|
|
6
|
+
const SPAWN_OPTS = { detached: true, stdio: 'ignore', windowsHide: false };
|
|
7
|
+
|
|
8
|
+
function commandsFor(targetPath, what, platform) {
|
|
9
|
+
const plat = platform || process.platform;
|
|
10
|
+
if (what !== 'folder' && what !== 'terminal') return [];
|
|
11
|
+
if (plat === 'win32') {
|
|
12
|
+
if (what === 'folder') return [['explorer.exe', [targetPath]]];
|
|
13
|
+
return [
|
|
14
|
+
['wt.exe', ['-d', targetPath]],
|
|
15
|
+
// fallback: a detached console gets its own window; the folder is passed as cwd, never re-parsed by cmd
|
|
16
|
+
['cmd.exe', ['/K'], { cwd: targetPath }],
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
if (plat === 'darwin') {
|
|
20
|
+
if (what === 'folder') return [['open', [targetPath]]];
|
|
21
|
+
return [['open', ['-a', 'Terminal', targetPath]]];
|
|
22
|
+
}
|
|
23
|
+
if (what === 'folder') return [['xdg-open', [targetPath]]];
|
|
24
|
+
return [
|
|
25
|
+
['x-terminal-emulator', ['--working-directory=' + targetPath]],
|
|
26
|
+
['gnome-terminal', ['--working-directory=' + targetPath]],
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function openPath(targetPath, what, opts) {
|
|
31
|
+
opts = opts || {};
|
|
32
|
+
const spawnFn = opts.spawn || childProcess.spawn;
|
|
33
|
+
const platform = opts.platform || process.platform;
|
|
34
|
+
const cmds = commandsFor(targetPath, what, platform);
|
|
35
|
+
if (!cmds.length) throw new Error('unsupported target: ' + what);
|
|
36
|
+
|
|
37
|
+
const launch = (idx) => {
|
|
38
|
+
const [cmd, args, extra] = cmds[idx];
|
|
39
|
+
let child;
|
|
40
|
+
try {
|
|
41
|
+
child = spawnFn(cmd, args, extra ? { ...SPAWN_OPTS, ...extra } : SPAWN_OPTS);
|
|
42
|
+
} catch (e) {
|
|
43
|
+
if (idx + 1 < cmds.length) return launch(idx + 1);
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
if (child && typeof child.on === 'function') {
|
|
47
|
+
child.on('error', () => {
|
|
48
|
+
if (idx + 1 < cmds.length) launch(idx + 1);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (child && typeof child.unref === 'function') child.unref();
|
|
52
|
+
return child;
|
|
53
|
+
};
|
|
54
|
+
return launch(0);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = { openPath, commandsFor, SPAWN_OPTS };
|