runwork 0.30.1 → 0.31.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/dist/index.js +390 -27
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -658,14 +658,144 @@ var execFileSync = (file, args, options) => {
|
|
|
658
658
|
var init_subprocess = () => {};
|
|
659
659
|
|
|
660
660
|
// src/agents/detection-probes.ts
|
|
661
|
+
function posixShellQuote(value) {
|
|
662
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
663
|
+
}
|
|
661
664
|
function powershellQuote(value) {
|
|
662
665
|
return `'${value.replace(/'/g, "''")}'`;
|
|
663
666
|
}
|
|
664
667
|
function isValidBundleId(id) {
|
|
665
668
|
return /^[A-Za-z0-9][A-Za-z0-9.-]*$/.test(id);
|
|
666
669
|
}
|
|
670
|
+
function macosLaunchServicesLookup(id) {
|
|
671
|
+
return `ObjC.import("AppKit");` + `var u=$.NSWorkspace.sharedWorkspace.URLForApplicationWithBundleIdentifier("${id}");`;
|
|
672
|
+
}
|
|
667
673
|
function macosBundleIdProbeScript(id) {
|
|
668
|
-
|
|
674
|
+
const lookup = `${macosLaunchServicesLookup(id)}u.isNil()?"":ObjC.unwrap(u.path)`;
|
|
675
|
+
return `p=$(osascript -l JavaScript -e '${lookup}' 2>/dev/null); ` + `if [ -n "$p" ] && [ -d "$p" ]; then exit 0; fi; ` + `p=$(mdfind "kMDItemCFBundleIdentifier == '${id}'" 2>/dev/null | head -1); ` + `if [ -n "$p" ]; then exit 0; fi; ` + `for a in /Applications/*.app "$HOME"/Applications/*.app; do ` + `[ -e "$a" ] || continue; ` + `if [ "$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' "$a/Contents/Info.plist" 2>/dev/null)" = "${id}" ]; then exit 0; fi; ` + `done; exit 1`;
|
|
676
|
+
}
|
|
677
|
+
function macosAppStateScript(id) {
|
|
678
|
+
if (!isValidBundleId(id))
|
|
679
|
+
return null;
|
|
680
|
+
const program = `${macosLaunchServicesLookup(id)}` + `var a=$.NSRunningApplication.runningApplicationsWithBundleIdentifier("${id}");` + `var r=[];` + `for(var i=0;i<a.count;i++){var p=a.objectAtIndex(i);r.push({` + `pid:p.processIdentifier,` + `exe:p.executableURL.isNil()?null:ObjC.unwrap(p.executableURL.path),` + `startedSecondsAgo:p.launchDate.isNil()?null:Math.round(Date.now()/1000-p.launchDate.timeIntervalSince1970)});}` + `JSON.stringify({path:u.isNil()?null:ObjC.unwrap(u.path),running:r});`;
|
|
681
|
+
return `osascript -l JavaScript -e '${program}'`;
|
|
682
|
+
}
|
|
683
|
+
function parseMacosAppState(stdout) {
|
|
684
|
+
let parsed;
|
|
685
|
+
try {
|
|
686
|
+
parsed = JSON.parse(stdout.trim());
|
|
687
|
+
} catch {
|
|
688
|
+
return null;
|
|
689
|
+
}
|
|
690
|
+
if (typeof parsed !== "object" || parsed === null)
|
|
691
|
+
return null;
|
|
692
|
+
const { path, running } = parsed;
|
|
693
|
+
if (path !== null && typeof path !== "string")
|
|
694
|
+
return null;
|
|
695
|
+
if (!Array.isArray(running))
|
|
696
|
+
return null;
|
|
697
|
+
const rows = [];
|
|
698
|
+
for (const row of running) {
|
|
699
|
+
if (typeof row !== "object" || row === null)
|
|
700
|
+
return null;
|
|
701
|
+
const { pid, exe, startedSecondsAgo } = row;
|
|
702
|
+
if (typeof pid !== "number")
|
|
703
|
+
return null;
|
|
704
|
+
if (exe !== null && typeof exe !== "string")
|
|
705
|
+
return null;
|
|
706
|
+
if (startedSecondsAgo !== null && typeof startedSecondsAgo !== "number")
|
|
707
|
+
return null;
|
|
708
|
+
rows.push({ pid, exe, startedSecondsAgo });
|
|
709
|
+
}
|
|
710
|
+
return { path, running: rows };
|
|
711
|
+
}
|
|
712
|
+
function macosAppEvidenceScript(query) {
|
|
713
|
+
if ("bundleId" in query && !isValidBundleId(query.bundleId))
|
|
714
|
+
return null;
|
|
715
|
+
const asked = "bundleId" in query ? { id: query.bundleId } : { name: query.appName };
|
|
716
|
+
const program = `ObjC.import("AppKit");` + `function s(v){return (v===undefined||v===null||v.isNil())?null:ObjC.unwrap(v);}` + `var q=${JSON.stringify(asked)};var ws=$.NSWorkspace.sharedWorkspace;var path=null;` + `if(q.id){var u=ws.URLForApplicationWithBundleIdentifier(q.id);path=u.isNil()?null:ObjC.unwrap(u.path);}` + `else{path=s(ws.fullPathForApplication(q.name));}` + `var info=null;` + `if(path){var b=$.NSBundle.bundleWithPath(path);if(!b.isNil()){var d=b.infoDictionary;info={` + `bundleId:s(d.objectForKey("CFBundleIdentifier")),` + `executable:s(d.objectForKey("CFBundleExecutable")),` + `version:s(d.objectForKey("CFBundleShortVersionString"))};}}` + `var r=[];var id=q.id||(info&&info.bundleId);` + `if(id){var a=$.NSRunningApplication.runningApplicationsWithBundleIdentifier(id);` + `for(var i=0;i<a.count;i++){var p=a.objectAtIndex(i);r.push({pid:p.processIdentifier,` + `exe:p.executableURL.isNil()?null:ObjC.unwrap(p.executableURL.path),` + `startedSecondsAgo:p.launchDate.isNil()?null:Math.round(Date.now()/1000-p.launchDate.timeIntervalSince1970)});}}` + `JSON.stringify({asked:q,path:path,info:info,running:r});`;
|
|
717
|
+
return `osascript -l JavaScript -e ${posixShellQuote(program)}`;
|
|
718
|
+
}
|
|
719
|
+
function macosAppProcessesScript(apps) {
|
|
720
|
+
const ids = apps.bundleIds.filter(isValidBundleId);
|
|
721
|
+
const lookup = (id) => `${macosLaunchServicesLookup(id)}u.isNil()?"":ObjC.unwrap(u.path)`;
|
|
722
|
+
const byId = ids.map((id) => `p=$(osascript -l JavaScript -e ${posixShellQuote(lookup(id))} 2>/dev/null); if [ -n "$p" ]; then printf '%s
|
|
723
|
+
' "$t" | grep -F -- "$p/"; fi; `).join("");
|
|
724
|
+
const names = apps.appNames.map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
725
|
+
const byName = names ? `printf '%s
|
|
726
|
+
' "$t" | grep -E -- ${posixShellQuote(`/(${names})\\.app/`)}; ` : "";
|
|
727
|
+
return `t=$(ps -axo pid=,etime=,comm=); ${byId}${byName}true`;
|
|
728
|
+
}
|
|
729
|
+
function windowsAppRunningScript(app) {
|
|
730
|
+
const packages = `@(${app.packageNames.map(powershellQuote).join(",")})`;
|
|
731
|
+
return [
|
|
732
|
+
`$ErrorActionPreference = 'SilentlyContinue'`,
|
|
733
|
+
`$packages = ${packages}`,
|
|
734
|
+
`$locations = @(Get-AppxPackage | Where-Object { $packages -contains $_.Name } | ForEach-Object { $_.InstallLocation } | Where-Object { $_ })`,
|
|
735
|
+
`$processes = @(Get-Process)`,
|
|
736
|
+
`$via = 'package'`,
|
|
737
|
+
`$found = @($processes | Where-Object { $path = $_.Path; $path -and @($locations | Where-Object { $path -like ($_ + '*') }).Count -gt 0 } | Sort-Object StartTime | Select-Object -First 1)`,
|
|
738
|
+
`if ($found.Count -eq 0) { $via = 'name'; $found = @($processes | Where-Object { $_.Name -eq ${powershellQuote(app.processName)} } | Sort-Object StartTime | Select-Object -First 1) }`,
|
|
739
|
+
`if ($found.Count -eq 0) { 'NONE' } else { $age = [int]((Get-Date) - $found[0].StartTime).TotalSeconds; "$via $age" }`
|
|
740
|
+
].join("; ");
|
|
741
|
+
}
|
|
742
|
+
function parseWindowsAppRunning(stdout) {
|
|
743
|
+
const m = stdout.trim().match(/^(package|name)(?:\s+(\d+))?$/);
|
|
744
|
+
if (!m)
|
|
745
|
+
return null;
|
|
746
|
+
return {
|
|
747
|
+
via: m[1] === "package" ? "windows-package-folder" : "windows-process-name",
|
|
748
|
+
startedSecondsAgo: m[2] !== undefined ? Number(m[2]) : null
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
function windowsAppEvidenceScript(apps) {
|
|
752
|
+
const list = (values) => `@(${values.map(powershellQuote).join(",")})`;
|
|
753
|
+
const patterns = apps.appNames.map((n) => `*${n}*`);
|
|
754
|
+
return [
|
|
755
|
+
`$ErrorActionPreference = 'SilentlyContinue'`,
|
|
756
|
+
`$packages = ${list(apps.packageNames)}`,
|
|
757
|
+
`$patterns = ${list(patterns)}`,
|
|
758
|
+
`$appx = @(Get-AppxPackage | Where-Object { $packages -contains $_.Name } | ForEach-Object { $pkg = $_; $apps = @(); try { $apps = @((Get-AppxPackageManifest $pkg).Package.Applications.Application | Select-Object Id, Executable) } catch { }; $pkg | Select-Object Name, PackageFamilyName, InstallLocation, Version, @{ Name = 'Applications'; Expression = { $apps } } })`,
|
|
759
|
+
`$startApps = @(Get-StartApps | Where-Object { $n = $_.Name; @($patterns | Where-Object { $n -like $_ }).Count -gt 0 } | Select-Object Name, AppID)`,
|
|
760
|
+
`$uninstall = @(Get-ItemProperty 'HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*', 'HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*', 'HKLM:\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*' | Where-Object { $d = $_.DisplayName; $d -and @($patterns | Where-Object { $d -like $_ }).Count -gt 0 } | Select-Object DisplayName, DisplayVersion, InstallLocation, DisplayIcon)`,
|
|
761
|
+
`$locations = @(@($appx | ForEach-Object { $_.InstallLocation }) + @($uninstall | ForEach-Object { $_.InstallLocation }) | Where-Object { $_ })`,
|
|
762
|
+
`$processes = @(Get-Process | Where-Object { $p = $_.Path; $n = $_.Name; ($p -and @($locations | Where-Object { $p -like ($_ + '*') }).Count -gt 0) -or @($patterns | Where-Object { $n -like $_ }).Count -gt 0 } | Select-Object Name, Id, Path, StartTime)`,
|
|
763
|
+
`@{ appx = $appx; startApps = $startApps; uninstall = $uninstall; processes = $processes } | ConvertTo-Json -Depth 6 -Compress`
|
|
764
|
+
].join("; ");
|
|
765
|
+
}
|
|
766
|
+
function linuxAppEvidenceScript(names) {
|
|
767
|
+
const words = names.map((n) => n.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "")).filter(Boolean);
|
|
768
|
+
const pattern = posixShellQuote(`(${[...new Set(words)].join("|")})`);
|
|
769
|
+
return `ls /usr/share/applications /usr/local/share/applications "$HOME/.local/share/applications" /var/lib/flatpak/exports/share/applications /var/lib/snapd/desktop/applications 2>/dev/null | grep -iE -- ${pattern}; true`;
|
|
770
|
+
}
|
|
771
|
+
function parseEtimeToSeconds(etime) {
|
|
772
|
+
const m = etime.trim().match(/^(?:(\d+)-)?(?:(\d+):)?(\d+):(\d+)$/);
|
|
773
|
+
if (!m)
|
|
774
|
+
return null;
|
|
775
|
+
const days = m[1] ? Number(m[1]) : 0;
|
|
776
|
+
const hours = m[2] ? Number(m[2]) : 0;
|
|
777
|
+
return ((days * 24 + hours) * 60 + Number(m[3])) * 60 + Number(m[4]);
|
|
778
|
+
}
|
|
779
|
+
function macosMainProcesses(processTable, appName) {
|
|
780
|
+
const escaped = appName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
781
|
+
const mainExecutable = new RegExp(`/${escaped}\\.app/Contents/MacOS/[^/]+$`, "i");
|
|
782
|
+
let count = 0;
|
|
783
|
+
let oldest = null;
|
|
784
|
+
for (const raw of processTable.split(`
|
|
785
|
+
`)) {
|
|
786
|
+
const line = raw.trim();
|
|
787
|
+
const space = line.indexOf(" ");
|
|
788
|
+
if (space === -1)
|
|
789
|
+
continue;
|
|
790
|
+
const execPath = line.slice(space + 1).trim();
|
|
791
|
+
if (!mainExecutable.test(execPath))
|
|
792
|
+
continue;
|
|
793
|
+
count += 1;
|
|
794
|
+
const seconds = parseEtimeToSeconds(line.slice(0, space));
|
|
795
|
+
if (seconds !== null && (oldest === null || seconds > oldest))
|
|
796
|
+
oldest = seconds;
|
|
797
|
+
}
|
|
798
|
+
return { count, startedSecondsAgo: oldest };
|
|
669
799
|
}
|
|
670
800
|
function appxPackageProbeScript(pkg) {
|
|
671
801
|
return `$p = Get-AppxPackage -Name ${powershellQuote(pkg)} -ErrorAction SilentlyContinue; if ($null -ne $p) { exit 0 } exit 1`;
|
|
@@ -701,7 +831,7 @@ function parseConfigDeclaredPath(text, key) {
|
|
|
701
831
|
const path = match[1].replace(/\\(.)/g, "$1");
|
|
702
832
|
return path || null;
|
|
703
833
|
}
|
|
704
|
-
var PATH_REFRESH_FAILED_MARKER = "__runwork_path_refresh_failed__", WINDOWS_PATH_REFRESH, COMMAND_NOT_FOUND_EXIT_CODES, WINDOWS_PATH_PLACEHOLDERS;
|
|
834
|
+
var PATH_REFRESH_FAILED_MARKER = "__runwork_path_refresh_failed__", WINDOWS_PATH_REFRESH, MACOS_PROCESS_TABLE_COMMAND = "ps -axo etime=,comm=", COMMAND_NOT_FOUND_EXIT_CODES, WINDOWS_PATH_PLACEHOLDERS;
|
|
705
835
|
var init_detection_probes = __esm(() => {
|
|
706
836
|
WINDOWS_PATH_REFRESH = "try { $env:Path = [Environment]::GetEnvironmentVariable('Path','Machine') + ';' + " + "[Environment]::GetEnvironmentVariable('Path','User') + ';' + $env:Path } " + `catch { Write-Output '${PATH_REFRESH_FAILED_MARKER}' }; `;
|
|
707
837
|
COMMAND_NOT_FOUND_EXIT_CODES = [127, 9009];
|
|
@@ -795,23 +925,6 @@ function toSpawnSpec(binary, args) {
|
|
|
795
925
|
}
|
|
796
926
|
return { command: binary, args };
|
|
797
927
|
}
|
|
798
|
-
function isAppRunning(appName) {
|
|
799
|
-
try {
|
|
800
|
-
const os = platform();
|
|
801
|
-
if (os === "darwin") {
|
|
802
|
-
execFileSync("pgrep", ["-f", `${appName}.app`], { stdio: "pipe" });
|
|
803
|
-
return true;
|
|
804
|
-
} else if (os === "win32") {
|
|
805
|
-
const result = execFileSync("tasklist", ["/FI", `IMAGENAME eq ${appName}.exe`, "/NH"], { stdio: "pipe" }).toString();
|
|
806
|
-
return result.includes(`${appName}.exe`);
|
|
807
|
-
} else {
|
|
808
|
-
execFileSync("pgrep", ["-x", appName.toLowerCase()], { stdio: "pipe" });
|
|
809
|
-
return true;
|
|
810
|
-
}
|
|
811
|
-
} catch {
|
|
812
|
-
return false;
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
928
|
var RUNNABLE_PROBE_TIMEOUT_MS = 1e4, runnableCache;
|
|
816
929
|
var init_which = __esm(() => {
|
|
817
930
|
init_subprocess();
|
|
@@ -2930,6 +3043,19 @@ function chatgptTeamConnectSteps(confirmLead) {
|
|
|
2930
3043
|
{ id: "confirm", label: `${confirmLead}, ask "Do you have access to Runwork tools?" to confirm` }
|
|
2931
3044
|
];
|
|
2932
3045
|
}
|
|
3046
|
+
function appxPackagesOf(agent) {
|
|
3047
|
+
const fromDetection = (d) => !d ? [] : d.method === "windows-appx" ? [d.target].flat() : d.method === "any" ? d.target.flatMap(fromDetection) : [];
|
|
3048
|
+
return [...new Set([...[agent.launch?.appxPackage ?? []].flat(), ...fromDetection(agent.detection)])];
|
|
3049
|
+
}
|
|
3050
|
+
function detectionWithIdentity(agent) {
|
|
3051
|
+
const id = agent.launch?.bundleId?.macos;
|
|
3052
|
+
if (!id)
|
|
3053
|
+
return agent.detection;
|
|
3054
|
+
const byId = { method: "macos-bundle-id", target: id };
|
|
3055
|
+
const own = agent.detection.method === "any" ? agent.detection.target : [agent.detection];
|
|
3056
|
+
const rest = own.filter((d) => !(d.method === "macos-bundle-id" && [d.target].flat().includes(id)));
|
|
3057
|
+
return { method: "any", target: [byId, ...rest] };
|
|
3058
|
+
}
|
|
2933
3059
|
function getAgent(slug) {
|
|
2934
3060
|
return slugIndex.get(slug);
|
|
2935
3061
|
}
|
|
@@ -3050,6 +3176,8 @@ var init_registry_data = __esm(() => {
|
|
|
3050
3176
|
},
|
|
3051
3177
|
launch: {
|
|
3052
3178
|
app: { macos: "Claude", windows: "Claude" },
|
|
3179
|
+
bundleId: { macos: "com.anthropic.claudefordesktop" },
|
|
3180
|
+
appxPackage: "Claude",
|
|
3053
3181
|
deepLink: "claude://claude.ai/new?q={prompt}",
|
|
3054
3182
|
deepLinkInFolder: "claude://cowork/new?q={prompt}&folder={folder}",
|
|
3055
3183
|
deepLinkInFolderSplit: { gapMs: 500 },
|
|
@@ -3143,7 +3271,7 @@ var init_registry_data = __esm(() => {
|
|
|
3143
3271
|
{ method: "windows-appx", target: "Microsoft.M365Copilot" }
|
|
3144
3272
|
]
|
|
3145
3273
|
},
|
|
3146
|
-
launch: { app: { macos: "Microsoft 365 Copilot", windows: "Microsoft 365 Copilot" } },
|
|
3274
|
+
launch: { app: { macos: "Microsoft 365 Copilot", windows: "Microsoft 365 Copilot" }, bundleId: { macos: "com.microsoft.m365copilot" } },
|
|
3147
3275
|
logo: "microsoft-copilot",
|
|
3148
3276
|
downloadUrl: "https://www.microsoft.com/en-us/microsoft-365-copilot/download-copilot-app",
|
|
3149
3277
|
firstClass: true,
|
|
@@ -3170,6 +3298,7 @@ var init_registry_data = __esm(() => {
|
|
|
3170
3298
|
},
|
|
3171
3299
|
launch: {
|
|
3172
3300
|
app: { macos: "Cursor", windows: "Cursor" },
|
|
3301
|
+
bundleId: { macos: "com.todesktop.230313mzl4w4u92" },
|
|
3173
3302
|
cli: "cursor",
|
|
3174
3303
|
deepLink: "cursor://anysphere.cursor-deeplink/prompt?text={prompt}",
|
|
3175
3304
|
openInFolder: { rank: 3, shell: "cursor {dir}" }
|
|
@@ -3463,6 +3592,7 @@ var init_registry_data = __esm(() => {
|
|
|
3463
3592
|
},
|
|
3464
3593
|
launch: {
|
|
3465
3594
|
app: { macos: "Antigravity", windows: "Antigravity" },
|
|
3595
|
+
bundleId: { macos: "com.google.antigravity" },
|
|
3466
3596
|
cli: "antigravity",
|
|
3467
3597
|
openInFolder: { rank: 5, shell: "cd {dir} && antigravity" }
|
|
3468
3598
|
},
|
|
@@ -3565,7 +3695,7 @@ var init_registry_data = __esm(() => {
|
|
|
3565
3695
|
{ slug: "trae-cn", name: "Trae CN", description: "ByteDance AI coding IDE (China)", category: "ide", detection: { method: "binary", target: "trae-cn" }, skillsPaths: { global: ".trae-cn/skills", project: ".trae/skills" } },
|
|
3566
3696
|
{ slug: "mistral-vibe", name: "Mistral Vibe", aliases: ["vibe"], description: "Mistral's AI coding agent", category: "cli", detection: { method: "binary", target: "vibe" }, skillsPaths: { global: ".vibe/skills", project: ".vibe/skills" } },
|
|
3567
3697
|
{ slug: "verdent", name: "Verdent", description: "AI coding agent", category: "cli", detection: { method: "binary", target: "verdent" }, skillsPaths: { global: ".verdent/skills", project: ".verdent/skills" } },
|
|
3568
|
-
{ slug: "warp", name: "Warp Terminal", aliases: ["Warp AI"], description: "AI-powered terminal", category: "cli", detection: { method: "path", target: { macos: "/Applications/Warp.app", linux: "/usr/bin/warp-terminal" } }, launch: { app: { macos: "Warp", windows: "Warp" } }, skillsPaths: { global: ".agents/skills", project: ".agents/skills" } },
|
|
3698
|
+
{ slug: "warp", name: "Warp Terminal", aliases: ["Warp AI"], description: "AI-powered terminal", category: "cli", detection: { method: "path", target: { macos: "/Applications/Warp.app", linux: "/usr/bin/warp-terminal" } }, launch: { app: { macos: "Warp", windows: "Warp" }, bundleId: { macos: "dev.warp.Warp-Stable" } }, skillsPaths: { global: ".agents/skills", project: ".agents/skills" } },
|
|
3569
3699
|
{ slug: "witsy", name: "Witsy", description: "AI coding agent", category: "cli", detection: { method: "binary", target: "witsy" }, skillsPaths: { global: ".agents/skills", project: ".agents/skills" } },
|
|
3570
3700
|
{ slug: "xcode-claude", name: "Xcode Claude", description: "Claude integration for Xcode", category: "extension", detection: { method: "path", target: { macos: "Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig" } }, logo: "claude", skillsPaths: { global: "Library/Developer/Xcode/CodingAssistant/ClaudeAgentConfig/skills", project: ".claude/skills" } },
|
|
3571
3701
|
{ slug: "xcode-codex", name: "Xcode Codex", description: "Codex integration for Xcode", category: "extension", detection: { method: "path", target: { macos: "Library/Developer/Xcode/CodingAssistant/codex" } }, logo: "openai", skillsPaths: { global: "Library/Developer/Xcode/CodingAssistant/codex/skills", project: ".codex/skills" } },
|
|
@@ -3575,6 +3705,7 @@ var init_registry_data = __esm(() => {
|
|
|
3575
3705
|
slugIndex = new Map;
|
|
3576
3706
|
nameIndex = new Map;
|
|
3577
3707
|
for (const agent of AGENT_REGISTRY) {
|
|
3708
|
+
agent.detection = detectionWithIdentity(agent);
|
|
3578
3709
|
slugIndex.set(agent.slug, agent);
|
|
3579
3710
|
nameIndex.set(agent.name, agent);
|
|
3580
3711
|
if (agent.aliases) {
|
|
@@ -4990,13 +5121,17 @@ async function runCapture(port, producer, steps, opts = {}) {
|
|
|
4990
5121
|
steps: steps.map((s) => ({ id: s.id, kind: s.kind, ...s.note ? { note: s.note } : {} }))
|
|
4991
5122
|
});
|
|
4992
5123
|
let stepsRun = 0;
|
|
5124
|
+
const facts = [];
|
|
4993
5125
|
for (const step of steps) {
|
|
4994
|
-
|
|
5126
|
+
const record = await runStep(port, step, deadlineMs);
|
|
5127
|
+
await port.append(record);
|
|
5128
|
+
if (record.type === "step")
|
|
5129
|
+
facts.push(record);
|
|
4995
5130
|
stepsRun++;
|
|
4996
5131
|
}
|
|
4997
5132
|
if (opts.claims) {
|
|
4998
5133
|
try {
|
|
4999
|
-
for (const claim of await opts.claims())
|
|
5134
|
+
for (const claim of await opts.claims(facts))
|
|
5000
5135
|
await port.append(claim);
|
|
5001
5136
|
} catch (err) {
|
|
5002
5137
|
await port.append({
|
|
@@ -8437,6 +8572,60 @@ var init_rollout_listing = __esm(() => {
|
|
|
8437
8572
|
UUID_TAIL = /([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
|
8438
8573
|
});
|
|
8439
8574
|
|
|
8575
|
+
// src/agents/app-running.ts
|
|
8576
|
+
import { platform as nodePlatform } from "node:os";
|
|
8577
|
+
function appRunningState(slug, deps = nodeDeps) {
|
|
8578
|
+
const agent = getAgent(slug);
|
|
8579
|
+
const launch = agent?.launch;
|
|
8580
|
+
if (!agent || !launch)
|
|
8581
|
+
return UNKNOWN;
|
|
8582
|
+
if (deps.platform === "darwin") {
|
|
8583
|
+
const byId = launch.bundleId?.macos ? macosAppStateScript(launch.bundleId.macos) : null;
|
|
8584
|
+
try {
|
|
8585
|
+
if (byId) {
|
|
8586
|
+
const appState = parseMacosAppState(deps.exec("bash", ["-c", byId]));
|
|
8587
|
+
if (!appState)
|
|
8588
|
+
return UNKNOWN;
|
|
8589
|
+
return { state: appState.running.length > 0 ? "running" : "closed", matchedVia: "macos-bundle-id" };
|
|
8590
|
+
}
|
|
8591
|
+
const appName = launch.app?.macos;
|
|
8592
|
+
if (!appName)
|
|
8593
|
+
return UNKNOWN;
|
|
8594
|
+
const table = deps.exec("bash", ["-c", MACOS_PROCESS_TABLE_COMMAND]);
|
|
8595
|
+
return { state: macosMainProcesses(table, appName).count > 0 ? "running" : "closed", matchedVia: "macos-process-table" };
|
|
8596
|
+
} catch {
|
|
8597
|
+
return UNKNOWN;
|
|
8598
|
+
}
|
|
8599
|
+
}
|
|
8600
|
+
if (deps.platform === "win32") {
|
|
8601
|
+
const appName = launch.app?.windows;
|
|
8602
|
+
if (!appName)
|
|
8603
|
+
return UNKNOWN;
|
|
8604
|
+
const script = windowsAppRunningScript({
|
|
8605
|
+
packageNames: appxPackagesOf(agent),
|
|
8606
|
+
processName: appName.replace(/\.exe$/i, "")
|
|
8607
|
+
});
|
|
8608
|
+
try {
|
|
8609
|
+
const hit = parseWindowsAppRunning(deps.exec("powershell", ["-NoProfile", "-Command", script]));
|
|
8610
|
+
return hit ? { state: "running", matchedVia: hit.via } : UNKNOWN;
|
|
8611
|
+
} catch {
|
|
8612
|
+
return UNKNOWN;
|
|
8613
|
+
}
|
|
8614
|
+
}
|
|
8615
|
+
return UNKNOWN;
|
|
8616
|
+
}
|
|
8617
|
+
var nodeDeps, UNKNOWN;
|
|
8618
|
+
var init_app_running = __esm(() => {
|
|
8619
|
+
init_subprocess();
|
|
8620
|
+
init_registry_data();
|
|
8621
|
+
init_detection_probes();
|
|
8622
|
+
nodeDeps = {
|
|
8623
|
+
platform: nodePlatform(),
|
|
8624
|
+
exec: (program, args) => execFileSync(program, args, { stdio: "pipe", encoding: "utf-8" })
|
|
8625
|
+
};
|
|
8626
|
+
UNKNOWN = { state: "unknown", matchedVia: null };
|
|
8627
|
+
});
|
|
8628
|
+
|
|
8440
8629
|
// src/utils/setup-state.ts
|
|
8441
8630
|
import { existsSync as existsSync18, readFileSync as readFileSync13 } from "fs";
|
|
8442
8631
|
import { join as join20 } from "path";
|
|
@@ -8709,7 +8898,7 @@ var init_adapter3 = __esm(async () => {
|
|
|
8709
8898
|
init_skill_removal();
|
|
8710
8899
|
init_trash();
|
|
8711
8900
|
init_instruction_hint();
|
|
8712
|
-
|
|
8901
|
+
init_app_running();
|
|
8713
8902
|
init_detection();
|
|
8714
8903
|
init_health();
|
|
8715
8904
|
init_runtime2();
|
|
@@ -9304,7 +9493,7 @@ var init_adapter3 = __esm(async () => {
|
|
|
9304
9493
|
if (inSaved && inOrder && inLabels) {
|
|
9305
9494
|
return "already_registered";
|
|
9306
9495
|
}
|
|
9307
|
-
if (
|
|
9496
|
+
if (appRunningState("codex-app").state === "running") {
|
|
9308
9497
|
return "app_running";
|
|
9309
9498
|
}
|
|
9310
9499
|
if (!inSaved) {
|
|
@@ -19262,7 +19451,7 @@ function createKeyboardListener() {
|
|
|
19262
19451
|
}
|
|
19263
19452
|
|
|
19264
19453
|
// src/generated/version.ts
|
|
19265
|
-
var VERSION = "0.
|
|
19454
|
+
var VERSION = "0.31.0";
|
|
19266
19455
|
|
|
19267
19456
|
// src/commands/dev.ts
|
|
19268
19457
|
var exports_dev = {};
|
|
@@ -36706,6 +36895,7 @@ import { join as join79 } from "path";
|
|
|
36706
36895
|
init_transcript_stores();
|
|
36707
36896
|
init_declarations5();
|
|
36708
36897
|
init_registry_data();
|
|
36898
|
+
init_detection_probes();
|
|
36709
36899
|
var CONFIG_MAX_BYTES = 64 * 1024;
|
|
36710
36900
|
var LOG_TAIL_BYTES = 64 * 1024;
|
|
36711
36901
|
var CENSUS_MAX_ENTRIES = 200;
|
|
@@ -36810,11 +37000,74 @@ function buildCapturePlan(input) {
|
|
|
36810
37000
|
}
|
|
36811
37001
|
steps.push(...binaryResolutionSteps(input));
|
|
36812
37002
|
steps.push(...agentBinaryProbes(input));
|
|
37003
|
+
steps.push(...appIdentitySteps(input));
|
|
36813
37004
|
if (input.cliPath) {
|
|
36814
37005
|
steps.push({ id: "cli.version", kind: "exec", command: input.cliPath, args: ["--version"] }, { id: "cli.doctor", kind: "exec", command: input.cliPath, args: ["--json", "doctor", "-v"] }, { id: "cli.conversations", kind: "exec", command: input.cliPath, args: ["--json", "conversations", "status", "--days", "0"], note: "per-agent scan outcome, no conversation data" }, { id: "cli.stores", kind: "exec", command: input.cliPath, args: ["--json", "conversations", "stores"], note: "per-store contents and provenance, no conversation text" });
|
|
36815
37006
|
}
|
|
36816
37007
|
return steps;
|
|
36817
37008
|
}
|
|
37009
|
+
function appIdentitySteps(input) {
|
|
37010
|
+
const apps = getAgents().filter((a) => a.launch?.app || a.launch?.bundleId || a.launch?.appxPackage);
|
|
37011
|
+
if (input.platform === "darwin") {
|
|
37012
|
+
const steps = [];
|
|
37013
|
+
const bundleIds = [];
|
|
37014
|
+
const appNames = [];
|
|
37015
|
+
for (const agent of apps) {
|
|
37016
|
+
const bundleId = agent.launch?.bundleId?.macos;
|
|
37017
|
+
const appName = agent.launch?.app?.macos;
|
|
37018
|
+
const script = bundleId ? macosAppEvidenceScript({ bundleId }) : appName ? macosAppEvidenceScript({ appName }) : null;
|
|
37019
|
+
if (!script)
|
|
37020
|
+
continue;
|
|
37021
|
+
if (bundleId)
|
|
37022
|
+
bundleIds.push(bundleId);
|
|
37023
|
+
else if (appName)
|
|
37024
|
+
appNames.push(appName);
|
|
37025
|
+
steps.push({
|
|
37026
|
+
id: `app.${agent.slug}`,
|
|
37027
|
+
kind: "exec",
|
|
37028
|
+
command: "bash",
|
|
37029
|
+
args: ["-c", script],
|
|
37030
|
+
note: bundleId ? `${agent.name}: location, declared identity and running instances, by bundle id` : `${agent.name}: the same, by name; the bundle id it reports is one we have not verified`
|
|
37031
|
+
});
|
|
37032
|
+
}
|
|
37033
|
+
steps.push({
|
|
37034
|
+
id: "apps.processes",
|
|
37035
|
+
kind: "exec",
|
|
37036
|
+
command: "bash",
|
|
37037
|
+
args: ["-c", macosAppProcessesScript({ bundleIds, appNames })],
|
|
37038
|
+
note: "processes under those apps only: executable paths and ages, never arguments"
|
|
37039
|
+
});
|
|
37040
|
+
return steps;
|
|
37041
|
+
}
|
|
37042
|
+
if (input.platform === "win32") {
|
|
37043
|
+
const packageNames = new Set;
|
|
37044
|
+
const appNames = new Set;
|
|
37045
|
+
for (const agent of apps) {
|
|
37046
|
+
for (const pkg of appxPackagesOf(agent))
|
|
37047
|
+
packageNames.add(pkg);
|
|
37048
|
+
if (agent.launch?.app?.windows)
|
|
37049
|
+
appNames.add(agent.launch.app.windows);
|
|
37050
|
+
}
|
|
37051
|
+
return [
|
|
37052
|
+
{
|
|
37053
|
+
id: "apps.windows",
|
|
37054
|
+
kind: "exec",
|
|
37055
|
+
command: "powershell",
|
|
37056
|
+
args: ["-NoProfile", "-Command", windowsAppEvidenceScript({ packageNames: [...packageNames], appNames: [...appNames] })],
|
|
37057
|
+
note: "MSIX packages, Start-menu entries, uninstall rows and processes, for the agents in the registry only"
|
|
37058
|
+
}
|
|
37059
|
+
];
|
|
37060
|
+
}
|
|
37061
|
+
return [
|
|
37062
|
+
{
|
|
37063
|
+
id: "apps.linux",
|
|
37064
|
+
kind: "exec",
|
|
37065
|
+
command: "bash",
|
|
37066
|
+
args: ["-c", linuxAppEvidenceScript(apps.flatMap((a) => [a.name, a.launch?.cli ?? ""]).filter(Boolean))],
|
|
37067
|
+
note: "desktop entries naming an agent in the registry; no agent declares a Linux app yet"
|
|
37068
|
+
}
|
|
37069
|
+
];
|
|
37070
|
+
}
|
|
36818
37071
|
function parentsWorthProbing(storePath4, sep12) {
|
|
36819
37072
|
const idx = storePath4.lastIndexOf(sep12);
|
|
36820
37073
|
if (idx <= 0)
|
|
@@ -36868,6 +37121,71 @@ function binaryResolutionSteps(input) {
|
|
|
36868
37121
|
...input.platform === "darwin" ? [{ id: "binaries.usr-local-bin", kind: "stat", path: "/usr/local/bin/runwork" }] : []
|
|
36869
37122
|
];
|
|
36870
37123
|
}
|
|
37124
|
+
function detectionRungs(detection) {
|
|
37125
|
+
return detection.method === "any" ? detection.target : [detection];
|
|
37126
|
+
}
|
|
37127
|
+
function looksForAppBundle(detection) {
|
|
37128
|
+
switch (detection.method) {
|
|
37129
|
+
case "macos-bundle-id":
|
|
37130
|
+
return true;
|
|
37131
|
+
case "path": {
|
|
37132
|
+
const target = typeof detection.target === "string" ? detection.target : detection.target.macos ?? detection.target.default;
|
|
37133
|
+
return typeof target === "string" && target.endsWith(".app");
|
|
37134
|
+
}
|
|
37135
|
+
case "any":
|
|
37136
|
+
return detection.target.some(looksForAppBundle);
|
|
37137
|
+
default:
|
|
37138
|
+
return false;
|
|
37139
|
+
}
|
|
37140
|
+
}
|
|
37141
|
+
function mainExecutableOf(text2, path4) {
|
|
37142
|
+
try {
|
|
37143
|
+
const parsed = JSON.parse(text2.trim());
|
|
37144
|
+
if (typeof parsed !== "object" || parsed === null)
|
|
37145
|
+
return null;
|
|
37146
|
+
const info = parsed.info;
|
|
37147
|
+
if (typeof info !== "object" || info === null)
|
|
37148
|
+
return null;
|
|
37149
|
+
const executable = info.executable;
|
|
37150
|
+
return typeof executable === "string" && executable ? `${path4}/Contents/MacOS/${executable}` : null;
|
|
37151
|
+
} catch {
|
|
37152
|
+
return null;
|
|
37153
|
+
}
|
|
37154
|
+
}
|
|
37155
|
+
function appIdentityDisagreements(conclusions, facts) {
|
|
37156
|
+
const byId = new Map(facts.map((f) => [f.id, f]));
|
|
37157
|
+
const table = byId.get("apps.processes");
|
|
37158
|
+
const tableLines = table?.status === "ok" && table.text ? table.text.split(`
|
|
37159
|
+
`).map((l) => l.trim()).filter(Boolean) : [];
|
|
37160
|
+
const checked = [];
|
|
37161
|
+
const disagreements = [];
|
|
37162
|
+
for (const c of conclusions) {
|
|
37163
|
+
const step = `app.${c.slug}`;
|
|
37164
|
+
const record = byId.get(step);
|
|
37165
|
+
if (record?.status !== "ok" || !record.text)
|
|
37166
|
+
continue;
|
|
37167
|
+
const state = parseMacosAppState(record.text);
|
|
37168
|
+
if (!state)
|
|
37169
|
+
continue;
|
|
37170
|
+
checked.push(c.slug);
|
|
37171
|
+
const instances = state.running.length;
|
|
37172
|
+
const mainExe = state.path ? mainExecutableOf(record.text, state.path) : null;
|
|
37173
|
+
const inTable = mainExe ? tableLines.some((line) => line.endsWith(` ${mainExe}`)) : false;
|
|
37174
|
+
if (c.running === "closed" && instances > 0) {
|
|
37175
|
+
disagreements.push({ slug: c.slug, kind: "closed-but-running", claim: "running: closed", fact: `${instances} running instance(s)`, step });
|
|
37176
|
+
}
|
|
37177
|
+
if (c.running === "closed" && inTable) {
|
|
37178
|
+
disagreements.push({ slug: c.slug, kind: "closed-but-running", claim: "running: closed", fact: `process table shows ${mainExe}`, step: "apps.processes" });
|
|
37179
|
+
}
|
|
37180
|
+
if (c.running === "running" && instances === 0 && !inTable) {
|
|
37181
|
+
disagreements.push({ slug: c.slug, kind: "running-but-no-instance", claim: "running: running", fact: "no running instance and no main executable in the process table", step });
|
|
37182
|
+
}
|
|
37183
|
+
if (c.detected === false && state.path && looksForAppBundle(c.detection)) {
|
|
37184
|
+
disagreements.push({ slug: c.slug, kind: "not-detected-but-found", claim: "detected: false", fact: `app found at ${state.path}`, step });
|
|
37185
|
+
}
|
|
37186
|
+
}
|
|
37187
|
+
return { checked, disagreements };
|
|
37188
|
+
}
|
|
36871
37189
|
|
|
36872
37190
|
// src/commands/debug.ts
|
|
36873
37191
|
init_capture();
|
|
@@ -37015,6 +37333,9 @@ function createNodeCapturePort(outputPath) {
|
|
|
37015
37333
|
}
|
|
37016
37334
|
|
|
37017
37335
|
// src/commands/debug.ts
|
|
37336
|
+
init_registry_data();
|
|
37337
|
+
init_detection();
|
|
37338
|
+
init_app_running();
|
|
37018
37339
|
init_transcript_stores();
|
|
37019
37340
|
init_transcript_sources();
|
|
37020
37341
|
init_which();
|
|
@@ -37026,7 +37347,48 @@ function defaultOutputPath(now) {
|
|
|
37026
37347
|
const stamp = now.toISOString().replace(/[:.]/g, "-").replace("T", "_").slice(0, 19);
|
|
37027
37348
|
return join79(homedir50(), ".runwork", "debug", `runwork-debug-${stamp}.jsonl`);
|
|
37028
37349
|
}
|
|
37029
|
-
async function
|
|
37350
|
+
async function detectionByRung(detection) {
|
|
37351
|
+
const rungs = detectionRungs(detection);
|
|
37352
|
+
return Promise.all(rungs.map(async (probe) => ({
|
|
37353
|
+
probe,
|
|
37354
|
+
answer: await runAgentDetectionDetailed(probe).catch((err) => ({
|
|
37355
|
+
detected: false,
|
|
37356
|
+
error: err instanceof Error ? err.message : String(err)
|
|
37357
|
+
}))
|
|
37358
|
+
})));
|
|
37359
|
+
}
|
|
37360
|
+
async function appIdentityClaims(facts) {
|
|
37361
|
+
const apps = getAgents().filter((a) => a.launch?.app || a.launch?.bundleId || a.launch?.appxPackage);
|
|
37362
|
+
const value = [];
|
|
37363
|
+
const conclusions = [];
|
|
37364
|
+
for (const agent of apps) {
|
|
37365
|
+
const detection = await runAgentDetectionDetailed(agent.detection).catch((err) => ({
|
|
37366
|
+
detected: false,
|
|
37367
|
+
error: err instanceof Error ? err.message : String(err)
|
|
37368
|
+
}));
|
|
37369
|
+
const rungs = await detectionByRung(agent.detection);
|
|
37370
|
+
const running = appRunningState(agent.slug);
|
|
37371
|
+
value.push({ slug: agent.slug, detection, rungs, running });
|
|
37372
|
+
conclusions.push({
|
|
37373
|
+
slug: agent.slug,
|
|
37374
|
+
detection: agent.detection,
|
|
37375
|
+
detected: "error" in detection ? null : detection.detected,
|
|
37376
|
+
running: running.state
|
|
37377
|
+
});
|
|
37378
|
+
}
|
|
37379
|
+
const derivedFrom = [...apps.map((a) => `app.${a.slug}`), "apps.processes", "apps.windows", "apps.linux"];
|
|
37380
|
+
return [
|
|
37381
|
+
{ type: "claim", id: "apps.identity", producer: "cli", derivedFrom, value },
|
|
37382
|
+
{
|
|
37383
|
+
type: "claim",
|
|
37384
|
+
id: "apps.identity.disagreements",
|
|
37385
|
+
producer: "cli",
|
|
37386
|
+
derivedFrom: ["apps.identity", ...derivedFrom],
|
|
37387
|
+
value: appIdentityDisagreements(conclusions, facts)
|
|
37388
|
+
}
|
|
37389
|
+
];
|
|
37390
|
+
}
|
|
37391
|
+
async function cliClaims(facts) {
|
|
37030
37392
|
const records = [];
|
|
37031
37393
|
records.push({
|
|
37032
37394
|
type: "claim",
|
|
@@ -37069,6 +37431,7 @@ async function cliClaims() {
|
|
|
37069
37431
|
};
|
|
37070
37432
|
})
|
|
37071
37433
|
});
|
|
37434
|
+
records.push(...await appIdentityClaims(facts));
|
|
37072
37435
|
records.push(spaceFoldersClaim());
|
|
37073
37436
|
return records;
|
|
37074
37437
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "runwork",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "CLI for Runwork: develop, preview, and deploy Runwork apps from your local machine.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Runwork, Inc. <info@runwork.ai> (https://www.runwork.ai)",
|