Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: packaged app startup and macOS signature

Samrat Talukdar8e2dc2a0d192
diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml
index d9a82464..903c6f2f 100644
--- a/.github/workflows/release-desktop.yml
+++ b/.github/workflows/release-desktop.yml
@@ -148,6 +148,10 @@ jobs:
${{ matrix.builder_args }} \
--publish never
+ - name: Verify packaged server imports
+ shell: bash
+ run: node apps/desktop/scripts/verify-packaged-imports.mjs
+
- name: Verify and upload installers
env:
GH_TOKEN: ${{ github.token }}
diff --git a/apps/desktop/electron/runtime.mjs b/apps/desktop/electron/runtime.mjs
index 2c5d8411..fa2c4e25 100644
--- a/apps/desktop/electron/runtime.mjs
+++ b/apps/desktop/electron/runtime.mjs
@@ -598,7 +598,7 @@ function nvmVersionBinPaths(home) {
}
// PATH resolution for the server and the sidecars it spawns. The engine-side
-// twin lives in apps/server/src/opencode-plugins/managed-policy-path.ts and
+// twin lives in apps/server/src/engine-shell-path.ts and
// must list the same directories (a server test compares the two), so the
// engine's bash tool finds git and gh the way the packaged app does.
export function pathHelperEntries() {
diff --git a/apps/desktop/scripts/electron-after-sign.cjs b/apps/desktop/scripts/electron-after-sign.cjs
index 9a5cd626..fa4b485f 100644
--- a/apps/desktop/scripts/electron-after-sign.cjs
+++ b/apps/desktop/scripts/electron-after-sign.cjs
@@ -58,16 +58,39 @@ function verifyComputerUseHelper(appPath, requireDistributionSignature) {
}
}
+
+/**
+ * Release builds run without a Developer ID certificate. electron-builder then
+ * leaves the bundle with only the linker's per-binary ad-hoc signature and no
+ * sealed resources, which Gatekeeper reports as "damaged and can't be opened".
+ * A proper ad-hoc deep signature turns that into the ordinary unidentified
+ * developer prompt (right-click > Open, or allow in Privacy & Security).
+ */
+function adHocSignIfUnsigned(appPath) {
+ const display = spawnSync("codesign", ["--display", "--verbose=2", appPath], { encoding: "utf8" });
+ const info = `${display.stdout || ""}${display.stderr || ""}`;
+ const verify = spawnSync("codesign", ["--verify", "--deep", "--strict", appPath], { encoding: "utf8" });
+ const developerSigned = /Authority=Developer ID Application/.test(info);
+ if (developerSigned && verify.status === 0) return false;
+ if (verify.status === 0 && !/linker-signed/.test(info)) return false;
+ console.warn("[electron-after-sign] no Developer ID signature found; applying an ad-hoc deep signature so Gatekeeper does not report the app as damaged.");
+ const entitlements = path.join(__dirname, "..", "build", "entitlements.mac.plist");
+ run("codesign", ["--force", "--deep", "--sign", "-", "--timestamp=none", "--options", "runtime", "--entitlements", entitlements, appPath]);
+ run("codesign", ["--verify", "--deep", "--strict", "--verbose=2", appPath]);
+ return true;
+}
+
async function afterSign(context) {
if (context.electronPlatformName !== "darwin") return;
+ const appName = `${context.packager.appInfo.productFilename}.app`;
+ const appPath = path.join(context.appOutDir, appName);
+ adHocSignIfUnsigned(appPath);
+
if (process.env.MACOS_NOTARIZE !== "true") {
console.warn("[electron-after-sign] MACOS_NOTARIZE is not true; skipping notarization.");
return;
}
-
- const appName = `${context.packager.appInfo.productFilename}.app`;
- const appPath = path.join(context.appOutDir, appName);
verifyComputerUseHelper(appPath, process.env.MACOS_NOTARIZE === "true");
const notaryTempDir = mkdtempSync(path.join(tmpdir(), "omnirush-electron-notary-"));
@@ -101,3 +124,4 @@ async function afterSign(context) {
module.exports = afterSign;
module.exports.default = afterSign;
module.exports.runWithRetry = runWithRetry;
+module.exports.adHocSignIfUnsigned = adHocSignIfUnsigned;
diff --git a/apps/desktop/scripts/verify-packaged-imports.mjs b/apps/desktop/scripts/verify-packaged-imports.mjs
new file mode 100644
index 00000000..b4e45b51
--- /dev/null
+++ b/apps/desktop/scripts/verify-packaged-imports.mjs
@@ -0,0 +1,95 @@
+#!/usr/bin/env node
+// Static import check for packaged desktop builds.
+//
+// The app archive deliberately excludes server/dist/opencode-plugins/** (the
+// plugin bundles ship as extra resources), so a relative import from a server
+// module into that folder resolves in development and crashes the installed
+// app at startup ("Cannot find module .../opencode-plugins/<file>.js").
+// This walks every JavaScript module inside each app.asar and verifies that
+// every relative import target exists inside the same archive.
+//
+// Usage: node apps/desktop/scripts/verify-packaged-imports.mjs [app.asar ...]
+// With no arguments it scans apps/desktop/dist-electron/** for app.asar files.
+import { readdirSync, statSync } from "node:fs";
+import { dirname, join, posix, resolve } from "node:path";
+import { fileURLToPath } from "node:url";
+import asar from "@electron/asar";
+
+const here = dirname(fileURLToPath(import.meta.url));
+const distElectron = resolve(here, "..", "dist-electron");
+
+function findAsars(dir, out = []) {
+ let entries = [];
+ try { entries = readdirSync(dir, { withFileTypes: true }); } catch { return out; }
+ for (const entry of entries) {
+ const path = join(dir, entry.name);
+ if (entry.isDirectory()) findAsars(path, out);
+ else if (entry.name === "app.asar") out.push(path);
+ }
+ return out;
+}
+
+const importPattern = /(?:^|[\s;])(?:import|export)\s+(?:[^"'`;]*?\s+from\s+)?["'](\.{1,2}\/[^"'`]+)["']|\bimport\(\s*["'](\.{1,2}\/[^"'`]+)["']\s*\)|\brequire\(\s*["'](\.{1,2}\/[^"'`]+)["']\s*\)/g;
+// Workspace packages resolve through their package.json "default" condition
+// under Electron's Node, which cannot load .ts files from node_modules.
+const workspacePattern = /(?:^|[\s;])(?:import|export)\s+(?:[^"'`;]*?\s+from\s+)?["'](@omnirush\/[^"'`]+)["']|\bimport\(\s*["'](@omnirush\/[^"'`]+)["']\s*\)/g;
+
+function workspaceTarget(asarPath, files, spec) {
+ const [, pkg, ...rest] = spec.split("/");
+ const manifestPath = `node_modules/@omnirush/${pkg}/package.json`;
+ if (!files.has(manifestPath)) return { error: `${manifestPath} missing from archive` };
+ const manifest = JSON.parse(asar.extractFile(asarPath, manifestPath).toString("utf8"));
+ const subpath = rest.length ? `./${rest.join("/")}` : ".";
+ const entry = manifest.exports?.[subpath] ?? (subpath === "." ? manifest.main : undefined);
+ const target = typeof entry === "string" ? entry : entry?.default ?? entry?.import ?? entry?.require;
+ if (typeof target !== "string") return { error: `no export for ${subpath}` };
+ if (target.endsWith(".ts")) return { error: `${subpath} default -> ${target} (TypeScript source cannot load from node_modules)` };
+ const resolved = posix.normalize(posix.join(`node_modules/@omnirush/${pkg}`, target));
+ return files.has(resolved) ? {} : { error: `${subpath} -> ${resolved} missing from archive` };
+}
+
+function checkAsar(asarPath) {
+ const files = new Set(asar.listPackage(asarPath).map((entry) => entry.replace(/\\/g, "/").replace(/^\//, "")));
+ // Third-party packages are resolved by Node with their own package.json exports; only first-party modules are checked.
+ const modules = [...files].filter((file) => /\.(?:m?js|cjs)$/.test(file) && !/(?:^|\/)node_modules\//.test(file) && !/\.test\.[mc]?js$/.test(file));
+ const missing = [];
+ for (const file of modules) {
+ let source;
+ try { source = asar.extractFile(asarPath, file).toString("utf8"); } catch { continue; }
+ // Ignore comments so JSDoc type imports such as import("../types") are not treated as runtime imports.
+ const code = source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:\\])\/\/.*$/gm, "$1");
+ for (const match of code.matchAll(importPattern)) {
+ const spec = match[1] ?? match[2] ?? match[3];
+ if (!spec) continue;
+ const target = posix.normalize(posix.join(posix.dirname(file), spec));
+ const candidates = [target, `${target}.js`, `${target}.mjs`, `${target}.cjs`, `${target}/index.js`, `${target}/package.json`];
+ if (!candidates.some((candidate) => files.has(candidate))) missing.push(`${file} -> ${spec}`);
+ }
+ for (const match of code.matchAll(workspacePattern)) {
+ const spec = match[1] ?? match[2];
+ if (!spec) continue;
+ const { error } = workspaceTarget(asarPath, files, spec);
+ if (error) missing.push(`${file} -> ${spec}: ${error}`);
+ }
+ }
+ return { modules: modules.length, missing };
+}
+
+const targets = process.argv.slice(2).length ? process.argv.slice(2) : findAsars(distElectron);
+if (targets.length === 0) {
+ console.error(`[verify-packaged-imports] no app.asar found under ${distElectron}`);
+ process.exit(2);
+}
+let failed = false;
+for (const target of targets) {
+ statSync(target);
+ const { modules, missing } = checkAsar(target);
+ if (missing.length) {
+ failed = true;
+ console.error(`[verify-packaged-imports] ${target}: ${missing.length} unresolved relative import(s) across ${modules} modules`);
+ for (const line of missing) console.error(` ${line}`);
+ } else {
+ console.log(`[verify-packaged-imports] ${target}: ${modules} modules, all relative imports resolve inside the archive`);
+ }
+}
+process.exit(failed ? 1 : 0);
diff --git a/apps/server/src/opencode-plugins/managed-policy-path.test.ts b/apps/server/src/engine-shell-path.test.ts
similarity index 96%
rename from apps/server/src/opencode-plugins/managed-policy-path.test.ts
rename to apps/server/src/engine-shell-path.test.ts
index a7577553..1c21ff69 100644
--- a/apps/server/src/opencode-plugins/managed-policy-path.test.ts
+++ b/apps/server/src/engine-shell-path.test.ts
@@ -3,9 +3,9 @@ import { mkdtempSync, mkdirSync, readFileSync } from "node:fs";
import { tmpdir } from "node:os";
import path from "node:path";
-import { applyEnginePath, enrichedPath, parsePathHelperOutput, pathHelperEntries, wellKnownPathEntries } from "./managed-policy-path.js";
+import { applyEnginePath, enrichedPath, parsePathHelperOutput, pathHelperEntries, wellKnownPathEntries } from "./engine-shell-path.js";
-const runtimeSource = readFileSync(path.resolve(import.meta.dir, "../../../desktop/electron/runtime.mjs"), "utf8");
+const runtimeSource = readFileSync(path.resolve(import.meta.dir, "../../desktop/electron/runtime.mjs"), "utf8");
/** Render an entry the way runtime.mjs spells it in extraPathEntries(). */
function runtimeSpelling(entry: string, home: string, env: Record<string, string>): string {
diff --git a/apps/server/src/opencode-plugins/managed-policy-path.ts b/apps/server/src/engine-shell-path.ts
similarity index 100%
rename from apps/server/src/opencode-plugins/managed-policy-path.ts
rename to apps/server/src/engine-shell-path.ts
diff --git a/apps/server/src/opencode-plugins/managed-policy-git.test.ts b/apps/server/src/git-command-policy.test.ts
similarity index 99%
rename from apps/server/src/opencode-plugins/managed-policy-git.test.ts
rename to apps/server/src/git-command-policy.test.ts
index 9ad0fb81..df015748 100644
--- a/apps/server/src/opencode-plugins/managed-policy-git.test.ts
+++ b/apps/server/src/git-command-policy.test.ts
@@ -1,7 +1,7 @@
import { describe, expect, test } from "bun:test";
-import { rulesFromPermissionConfig, winningRule } from "../effective-permissions.js";
-import { legacyExecutionPermissions } from "../managed-policy-rules.js";
+import { rulesFromPermissionConfig, winningRule } from "./effective-permissions.js";
+import { legacyExecutionPermissions } from "./managed-policy-rules.js";
import {
DESTRUCTIVE_MARKER,
classifyShellCommand,
@@ -10,7 +10,7 @@ import {
programTokens,
splitShellCommand,
stripDestructiveMarkers,
-} from "./managed-policy-git.js";
+} from "./git-command-policy.js";
function kinds(command: string): string[] {
return classifyShellCommand(command).map((entry) => `${entry.kind}:${entry.family ?? "-"}`);
diff --git a/apps/server/src/opencode-plugins/managed-policy-git.ts b/apps/server/src/git-command-policy.ts
similarity index 100%
rename from apps/server/src/opencode-plugins/managed-policy-git.ts
rename to apps/server/src/git-command-policy.ts
diff --git a/apps/server/src/managed-policy-rules.ts b/apps/server/src/managed-policy-rules.ts
index cea78fb2..20d61bf7 100644
--- a/apps/server/src/managed-policy-rules.ts
+++ b/apps/server/src/managed-policy-rules.ts
@@ -1,6 +1,6 @@
import type { DesktopConfig, DesktopExecutionPolicy, DesktopPolicyKey } from "@omnirush/types/den/desktop-policies";
import { z } from "zod";
-import { gitWorkflowPermissionRules } from "./opencode-plugins/managed-policy-git.js";
+import { gitWorkflowPermissionRules } from "./git-command-policy.js";
export const managedPolicyActionSchema = z.enum([
"sync", "shell", "terminal", "saved_command", "file_write", "engine_config", "browser_external",
diff --git a/apps/server/src/no-bare-fetch.test.ts b/apps/server/src/no-bare-fetch.test.ts
index 8bb687a2..71124872 100644
--- a/apps/server/src/no-bare-fetch.test.ts
+++ b/apps/server/src/no-bare-fetch.test.ts
@@ -45,7 +45,9 @@ test("server source does not use bare fetch", async () => {
const path = relativeSrcPath(file);
const lines = (await readFile(file, "utf8")).split(/\r?\n/);
lines.forEach((line, index) => {
- const code = line.replace(/\/\/.*$/, "");
+ // Words inside string literals (for example the git subcommand "fetch"
+ // in a command table) are data, not a fetch reference.
+ const code = line.replace(/\/\/.*$/, "").replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g, '""');
if (/^\s*[*/]/.test(code)) return;
if (bareFetchPattern.test(code)) offenders.push(`${path}:${index + 1}`);
});
diff --git a/apps/server/src/no-plugin-imports.test.ts b/apps/server/src/no-plugin-imports.test.ts
new file mode 100644
index 00000000..035ac47a
--- /dev/null
+++ b/apps/server/src/no-plugin-imports.test.ts
@@ -0,0 +1,38 @@
+import { test, expect } from "bun:test";
+import { readdir, readFile } from "node:fs/promises";
+import { dirname, join, relative, sep } from "node:path";
+import { fileURLToPath } from "node:url";
+
+const srcDir = dirname(fileURLToPath(import.meta.url));
+
+// The packaged desktop app excludes server/dist/opencode-plugins/** from the
+// app archive (apps/desktop/electron-builder.base.yml) and ships the plugin
+// bundles as extra resources instead. A server module that imports from that
+// folder therefore resolves in development and breaks the installed app at
+// startup ("Cannot find module .../opencode-plugins/<file>.js"). Shared code
+// belongs in apps/server/src and is imported by the plugins with "../".
+const pluginImport = /from\s+["'](?:\.\/|\.\.\/)?opencode-plugins\//;
+
+async function collect(dir: string): Promise<string[]> {
+ const entries = await readdir(dir, { withFileTypes: true });
+ const files: string[] = [];
+ for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
+ const path = join(dir, entry.name);
+ if (entry.isDirectory()) files.push(...await collect(path));
+ else if (entry.isFile() && entry.name.endsWith(".ts")) files.push(path);
+ }
+ return files;
+}
+
+test("server modules never import from the opencode-plugins folder", async () => {
+ const offenders: string[] = [];
+ for (const file of await collect(srcDir)) {
+ const rel = relative(srcDir, file).split(sep).join("/");
+ if (rel.startsWith("opencode-plugins/") || rel.endsWith(".test.ts")) continue;
+ const lines = (await readFile(file, "utf8")).split(/\r?\n/);
+ lines.forEach((line, index) => {
+ if (pluginImport.test(line)) offenders.push(`${rel}:${index + 1}`);
+ });
+ }
+ expect(offenders).toEqual([]);
+});
diff --git a/apps/server/src/omnirush-runtime-config.test.ts b/apps/server/src/omnirush-runtime-config.test.ts
index a2649252..512f62c0 100644
--- a/apps/server/src/omnirush-runtime-config.test.ts
+++ b/apps/server/src/omnirush-runtime-config.test.ts
@@ -11,7 +11,7 @@ import {
writeOmniRushRuntimeConfigFile,
} from "./omnirush-runtime-config.js";
import { writeGlobalRuntimeOpencodeConfig, writeRuntimeOpencodeConfig } from "./runtime-opencode-config-store.js";
-import { gitWorkflowPermissionRules } from "./opencode-plugins/managed-policy-git.js";
+import { gitWorkflowPermissionRules } from "./git-command-policy.js";
import type { ServerConfig } from "./types.js";
const roots: string[] = [];
diff --git a/apps/server/src/opencode-plugins/managed-policy-client.ts b/apps/server/src/opencode-plugins/managed-policy-client.ts
index af7a5135..25846816 100644
--- a/apps/server/src/opencode-plugins/managed-policy-client.ts
+++ b/apps/server/src/opencode-plugins/managed-policy-client.ts
@@ -5,7 +5,7 @@ import { isAbsolute, resolve } from "node:path";
import { promisify } from "node:util";
import type { ManagedPolicyAction } from "../managed-policy-rules.js";
-import { classifyShellCommand, markDestructiveCommands, type ClassifiedCommand, type IdentityFields } from "./managed-policy-git.js";
+import { classifyShellCommand, markDestructiveCommands, type ClassifiedCommand, type IdentityFields } from "../git-command-policy.js";
const execFileAsync = promisify(execFile);
const GIT_TIMEOUT_MS = 10_000;
diff --git a/apps/server/src/opencode-plugins/managed-policy-next.ts b/apps/server/src/opencode-plugins/managed-policy-next.ts
index fa6a3d1a..4bd8444e 100644
--- a/apps/server/src/opencode-plugins/managed-policy-next.ts
+++ b/apps/server/src/opencode-plugins/managed-policy-next.ts
@@ -1,5 +1,5 @@
import { check, checkManagedTool } from "./managed-policy-client.js";
-import { applyEnginePath } from "./managed-policy-path.js";
+import { applyEnginePath } from "../engine-shell-path.js";
// Plugin.define is the identity function in the pinned SDK. The structural
// contract avoids loading either engine's SDK into the other engine.
export default {
diff --git a/apps/server/src/opencode-plugins/managed-policy.test.ts b/apps/server/src/opencode-plugins/managed-policy.test.ts
index 4d814ed1..856db4a8 100644
--- a/apps/server/src/opencode-plugins/managed-policy.test.ts
+++ b/apps/server/src/opencode-plugins/managed-policy.test.ts
@@ -6,7 +6,7 @@ import path from "node:path";
import managedPolicy from "./managed-policy.js";
import managedPolicyNext from "./managed-policy-next.js";
-import { DESTRUCTIVE_MARKER } from "./managed-policy-git.js";
+import { DESTRUCTIVE_MARKER } from "../git-command-policy.js";
import { annotateShellOutput, prepareShellCommand, readGitIdentity } from "./managed-policy-client.js";
type EvaluateCall = { action: string; input: Record<string, unknown> };
diff --git a/apps/server/src/opencode-plugins/managed-policy.ts b/apps/server/src/opencode-plugins/managed-policy.ts
index ee432e02..18ef2cbe 100644
--- a/apps/server/src/opencode-plugins/managed-policy.ts
+++ b/apps/server/src/opencode-plugins/managed-policy.ts
@@ -1,5 +1,5 @@
import { annotateShellOutput, check, checkManagedTool } from "./managed-policy-client.js";
-import { applyEnginePath } from "./managed-policy-path.js";
+import { applyEnginePath } from "../engine-shell-path.js";
type ToolBeforeInput = { tool: string; sessionID?: string; callID?: string };
type ToolAfterInput = { tool: string; sessionID?: string; callID?: string; args?: unknown };
diff --git a/apps/server/src/types-package-exports.test.ts b/apps/server/src/types-package-exports.test.ts
index 2eb5d875..02a07bda 100644
--- a/apps/server/src/types-package-exports.test.ts
+++ b/apps/server/src/types-package-exports.test.ts
@@ -3,28 +3,35 @@ import { readFileSync } from "node:fs";
import { resolve } from "node:path";
/**
- * The packaged builds bundle this app's OpenCode plugins with `--target node`,
- * so every workspace import resolves through the exporting package's own
- * conditions. A subpath that points at `dist/` only resolves after that package
- * has been built, which the Docker and alpha pipelines do not guarantee — and
- * neither typechecks nor bun tests take that route, so nothing catches it
- * before merge. Keep every subpath resolvable from source.
+ * Two runtimes consume this package:
+ * - bun (dev server, tests, and the plugin bundles built with --target node)
+ * resolves the `bun` / `development` conditions and can execute TypeScript
+ * source directly, so those must point at `src/`.
+ * - the packaged desktop app runs the compiled server under Electron's Node,
+ * which refuses to strip types from `.ts` files under node_modules
+ * (ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING). Its `default` condition must
+ * therefore point at the built `dist/` output, which apps/server's build
+ * produces before packaging (v1.0.1 shipped with `default` -> src and the
+ * engine never started).
*/
describe("@omnirush/types package exports", () => {
const manifest = JSON.parse(
readFileSync(resolve(import.meta.dir, "../../../packages/types/package.json"), "utf8"),
) as { exports: Record<string, Record<string, string> | string> };
- test("every subpath resolves from source under every condition", () => {
- const buildDependent = Object.entries(manifest.exports).flatMap(([subpath, target]) => {
+ test("every subpath serves source to bun and built output to Node", () => {
+ const wrong = Object.entries(manifest.exports).flatMap(([subpath, target]) => {
const conditions = typeof target === "string" ? { default: target } : target;
- const offending = Object.entries(conditions)
- .filter(([, value]) => typeof value === "string" && value.includes("/dist/"))
- .map(([condition]) => condition);
- return offending.length > 0 ? [`${subpath} (${offending.join(", ")})`] : [];
+ const problems: string[] = [];
+ for (const condition of ["development", "bun"]) {
+ const value = conditions[condition];
+ if (typeof value !== "string" || !value.startsWith("./src/") || !value.endsWith(".ts")) problems.push(`${condition} must point at src/*.ts`);
+ }
+ const fallback = conditions.default;
+ if (typeof fallback !== "string" || !fallback.startsWith("./dist/") || !fallback.endsWith(".js")) problems.push("default must point at dist/*.js");
+ return problems.length > 0 ? [`${subpath}: ${problems.join("; ")}`] : [];
});
-
- expect(buildDependent).toEqual([]);
+ expect(wrong).toEqual([]);
});
test("the runtime subpaths this app imports are declared", () => {
@@ -32,7 +39,8 @@ describe("@omnirush/types package exports", () => {
// the type-only subpaths that surrounded it when it was introduced.
expect(manifest.exports["./automations"]).toMatchObject({
types: "./src/automations.ts",
- default: "./src/automations.ts",
+ bun: "./src/automations.ts",
+ default: "./dist/automations.js",
});
});
});
diff --git a/docs/git-workflows.md b/docs/git-workflows.md
index af868bac..17c646d4 100644
--- a/docs/git-workflows.md
+++ b/docs/git-workflows.md
@@ -17,7 +17,7 @@ managed-policy plugin, not in the model.
pyenv, `~/.local/bin`) for the server; the managed-policy plugin applies the
same list inside the engine, so a dev server started from a bare terminal
behaves like the packaged app. Sources: `apps/desktop/electron/runtime.mjs`
- and `apps/server/src/opencode-plugins/managed-policy-path.ts` (a test keeps
+ and `apps/server/src/engine-shell-path.ts` (a test keeps
the two lists identical).
- Worktrees: the agent prefers `git worktree add ../<repo>-<branch> -b <branch>`
for parallel branches and removes them when the work lands.
@@ -33,7 +33,7 @@ The rules are stated to the agent in its base prompt
Every shell command is split into segments (`&&`, `||`, `;`, `|`, newlines,
`$(...)`, subshells, brace groups) and each segment is classified by
-`apps/server/src/opencode-plugins/managed-policy-git.ts`. The classification
+`apps/server/src/git-command-policy.ts`. The classification
looks through what precedes or wraps the command: reserved words (`if`, `!`,
`while`, `do`, `time`), privilege and exec wrappers (`sudo`, `env`, `nohup`,
`nice`, `timeout`, `xargs`, `find -exec`) and interpreters that receive a
diff --git a/packages/types/package.json b/packages/types/package.json
index c3cbf3a2..0026f4f3 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -7,122 +7,146 @@
".": {
"types": "./src/index.ts",
"development": "./src/index.ts",
- "default": "./src/index.ts"
+ "bun": "./src/index.ts",
+ "default": "./dist/index.js"
},
"./agent-context-diagnostics": {
"types": "./src/agent-context-diagnostics.ts",
"development": "./src/agent-context-diagnostics.ts",
- "default": "./src/agent-context-diagnostics.ts"
+ "bun": "./src/agent-context-diagnostics.ts",
+ "default": "./dist/agent-context-diagnostics.js"
},
"./omnirush-affordance": {
"types": "./src/omnirush-affordance.ts",
"development": "./src/omnirush-affordance.ts",
- "default": "./src/omnirush-affordance.ts"
+ "bun": "./src/omnirush-affordance.ts",
+ "default": "./dist/omnirush-affordance.js"
},
"./omnirush-context": {
"types": "./src/omnirush-context.ts",
"development": "./src/omnirush-context.ts",
- "default": "./src/omnirush-context.ts"
+ "bun": "./src/omnirush-context.ts",
+ "default": "./dist/omnirush-context.js"
},
"./omnirush-provider": {
"types": "./src/omnirush-provider.ts",
"development": "./src/omnirush-provider.ts",
- "default": "./src/omnirush-provider.ts"
+ "bun": "./src/omnirush-provider.ts",
+ "default": "./dist/omnirush-provider.js"
},
"./automations": {
"types": "./src/automations.ts",
"development": "./src/automations.ts",
- "default": "./src/automations.ts"
+ "bun": "./src/automations.ts",
+ "default": "./dist/automations.js"
},
"./workflows": {
"types": "./src/workflows.ts",
"development": "./src/workflows.ts",
- "default": "./src/workflows.ts"
+ "bun": "./src/workflows.ts",
+ "default": "./dist/workflows.js"
},
"./local-workflows": {
"types": "./src/local-workflows.ts",
"development": "./src/local-workflows.ts",
- "default": "./src/local-workflows.ts"
+ "bun": "./src/local-workflows.ts",
+ "default": "./dist/local-workflows.js"
},
"./skill-created-app": {
"types": "./src/skill-created-app.ts",
"development": "./src/skill-created-app.ts",
- "default": "./src/skill-created-app.ts"
+ "bun": "./src/skill-created-app.ts",
+ "default": "./dist/skill-created-app.js"
},
"./connection-action-app": {
"types": "./src/connection-action-app.ts",
"development": "./src/connection-action-app.ts",
- "default": "./src/connection-action-app.ts"
+ "bun": "./src/connection-action-app.ts",
+ "default": "./dist/connection-action-app.js"
},
"./plugin-flow-app": {
"types": "./src/plugin-flow-app.ts",
"development": "./src/plugin-flow-app.ts",
- "default": "./src/plugin-flow-app.ts"
+ "bun": "./src/plugin-flow-app.ts",
+ "default": "./dist/plugin-flow-app.js"
},
"./den/desktop-app-restrictions": {
"types": "./src/den/desktop-app-restrictions.ts",
"development": "./src/den/desktop-app-restrictions.ts",
- "default": "./src/den/desktop-app-restrictions.ts"
+ "bun": "./src/den/desktop-app-restrictions.ts",
+ "default": "./dist/den/desktop-app-restrictions.js"
},
"./den/desktop-policies": {
"types": "./src/den/desktop-policies.ts",
"development": "./src/den/desktop-policies.ts",
- "default": "./src/den/desktop-policies.ts"
+ "bun": "./src/den/desktop-policies.ts",
+ "default": "./dist/den/desktop-policies.js"
},
"./den/connect-diagnostics": {
"types": "./src/den/connect-diagnostics.ts",
"development": "./src/den/connect-diagnostics.ts",
- "default": "./src/den/connect-diagnostics.ts"
+ "bun": "./src/den/connect-diagnostics.ts",
+ "default": "./dist/den/connect-diagnostics.js"
},
"./den/egress-diagnostics": {
"types": "./src/den/egress-diagnostics.ts",
"development": "./src/den/egress-diagnostics.ts",
- "default": "./src/den/egress-diagnostics.ts"
+ "bun": "./src/den/egress-diagnostics.ts",
+ "default": "./dist/den/egress-diagnostics.js"
},
"./den/managed-models-policy": {
"types": "./src/den/managed-models-policy.ts",
"development": "./src/den/managed-models-policy.ts",
- "default": "./src/den/managed-models-policy.ts"
+ "bun": "./src/den/managed-models-policy.ts",
+ "default": "./dist/den/managed-models-policy.js"
},
"./den/inference": {
"types": "./src/den/inference.ts",
"development": "./src/den/inference.ts",
- "default": "./src/den/inference.ts"
+ "bun": "./src/den/inference.ts",
+ "default": "./dist/den/inference.js"
},
"./den/microsoft-365": {
"types": "./src/den/microsoft-365.ts",
"development": "./src/den/microsoft-365.ts",
- "default": "./src/den/microsoft-365.ts"
+ "bun": "./src/den/microsoft-365.ts",
+ "default": "./dist/den/microsoft-365.js"
},
"./den/mcp-connection-action": {
"types": "./src/den/mcp-connection-action.ts",
"development": "./src/den/mcp-connection-action.ts",
- "default": "./src/den/mcp-connection-action.ts"
+ "bun": "./src/den/mcp-connection-action.ts",
+ "default": "./dist/den/mcp-connection-action.js"
},
"./workspace": {
"types": "./src/workspace.ts",
"development": "./src/workspace.ts",
- "default": "./src/workspace.ts"
+ "bun": "./src/workspace.ts",
+ "default": "./dist/workspace.js"
},
"./desktop-ipc": {
"types": "./src/desktop-ipc.ts",
"development": "./src/desktop-ipc.ts",
- "default": "./src/desktop-ipc.ts"
+ "bun": "./src/desktop-ipc.ts",
+ "default": "./dist/desktop-ipc.js"
},
"./connect-link": {
"types": "./src/connect-link.ts",
"development": "./src/connect-link.ts",
- "default": "./src/connect-link.ts"
+ "bun": "./src/connect-link.ts",
+ "default": "./dist/connect-link.js"
},
"./url": {
"types": "./src/url.ts",
"development": "./src/url.ts",
- "default": "./src/url.ts"
+ "bun": "./src/url.ts",
+ "default": "./dist/url.js"
},
"./visualization": {
"types": "./src/visualization.ts",
"development": "./src/visualization.ts",
- "default": "./src/visualization.ts"
+ "bun": "./src/visualization.ts",
+ "default": "./dist/visualization.js"
},
"./den/desktop-policies-runtime": {
"types": "./src/den/desktop-policies.ts",
diff --git a/packages/types/tsup.config.ts b/packages/types/tsup.config.ts
index 92226db5..a50f6187 100644
--- a/packages/types/tsup.config.ts
+++ b/packages/types/tsup.config.ts
@@ -10,6 +10,11 @@ export default defineConfig({
"automations": "src/automations.ts",
workflows: "src/workflows.ts",
"local-workflows": "src/local-workflows.ts",
+ workspace: "src/workspace.ts",
+ "desktop-ipc": "src/desktop-ipc.ts",
+ "connect-link": "src/connect-link.ts",
+ url: "src/url.ts",
+ visualization: "src/visualization.ts",
"skill-created-app": "src/skill-created-app.ts",
"connection-action-app": "src/connection-action-app.ts",
"plugin-flow-app": "src/plugin-flow-app.ts",