Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules/
dist/
release/
.vite/
.turbo/
out/
*.log

Expand All @@ -26,6 +27,7 @@ Thumbs.db
*.tmp
*.temp
*.tgz
.agent-trigger

AGENTS.md
.claude/
Expand Down
11 changes: 7 additions & 4 deletions apps/array/forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,16 @@ const config: ForgeConfig = {
],
hooks: {
generateAssets: async () => {
// Generate ICNS from source PNG
if (existsSync("build/icon@3x.png")) {
// Generate ICNS from source PNG (skip if already exists)
if (
existsSync("build/icon@3x.png") &&
!existsSync("build/app-icon.icns")
) {
execSync("bash scripts/generate-icns.sh", { stdio: "inherit" });
}

// Compile liquid glass icon to Assets.car
if (existsSync("build/icon.icon")) {
// Compile liquid glass icon to Assets.car (skip if already exists)
if (existsSync("build/icon.icon") && !existsSync("build/Assets.car")) {
execSync("bash scripts/compile-glass-icon.sh", { stdio: "inherit" });
}
},
Expand Down
2 changes: 0 additions & 2 deletions apps/array/scripts/generate-icns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ if [ ! -f "$SOURCE_PNG" ]; then
exit 1
fi

echo "Creating iconset from $SOURCE_PNG..."

mkdir -p "$ICONSET_DIR"

# Scale factor for macOS icon guidelines: 832/1024 = 13/16 = 0.8125
Expand Down
6 changes: 0 additions & 6 deletions apps/array/src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
// Legacy type kept for backwards compatibility with taskControllers map
type TaskController = unknown;

import { setupAgentHotReload } from "./services/dev-reload.js";
import { registerFileWatcherIpc } from "./services/fileWatcher.js";
import { registerFoldersIpc } from "./services/folders.js";
import { registerFsIpc } from "./services/fs.js";
Expand Down Expand Up @@ -204,11 +203,6 @@ app.whenReady().then(() => {
getOrRefreshApps().catch(() => {
// Silently fail, will retry on first use
});

// Dev mode: Watch agent package and restart via mprocs
if (MAIN_WINDOW_VITE_DEV_SERVER_URL) {
setupAgentHotReload();
}
});

app.on("window-all-closed", async () => {
Expand Down
33 changes: 0 additions & 33 deletions apps/array/src/main/services/dev-reload.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/array/src/main/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/

import "./contextMenu.js";
import "./dev-reload.js";
import "./externalApps.js";
import "./fileWatcher.js";
import "./folders.js";
Expand Down
18 changes: 7 additions & 11 deletions apps/array/vite.main.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ function copyAgentTemplates(): Plugin {

mkdirSync(join(__dirname, ".vite/build/templates"), { recursive: true });
copyFileSync(templateSrc, templateDest);
console.log("Copied agent templates to build directory");
},
};
}
Expand Down Expand Up @@ -102,23 +101,14 @@ function copyClaudeExecutable(): Plugin {
existsSync(join(candidate.path, "cli.js")) &&
existsSync(join(candidate.path, "yoga.wasm"))
) {
console.log(
`[copy-claude-executable] Found pre-built artifacts at ${candidate.path}`,
);
const files = ["cli.js", "package.json", "yoga.wasm"];
for (const file of files) {
copyFileSync(join(candidate.path, file), join(destDir, file));
}
console.log("Copied Claude CLI to claude-cli/ subdirectory");
return;
}
}

// Fallback: Assemble from individual source packages (Development Workspace)
console.log(
"[copy-claude-executable] Pre-built artifacts not found. Attempting to assemble from workspace sources...",
);

const rootNodeModules = join(__dirname, "../../node_modules");
const sdkDir = join(rootNodeModules, "@anthropic-ai/claude-agent-sdk");
const yogaDir = join(rootNodeModules, "yoga-wasm-web/dist");
Expand Down Expand Up @@ -165,14 +155,20 @@ export default defineConfig({
"@api": path.resolve(__dirname, "./src/api"),
},
},
cacheDir: ".vite/cache",
build: {
target: "node18",
minify: false, // Disable minification to prevent variable name conflicts
minify: false,
reportCompressedSize: false,
commonjsOptions: {
transformMixedEsModules: true,
},
rollupOptions: {
external: ["node-pty", "@parcel/watcher", "file-icon"],
onwarn(warning, warn) {
if (warning.code === "UNUSED_EXTERNAL_IMPORT") return;
warn(warning);
},
},
},
});
11 changes: 5 additions & 6 deletions mprocs.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
procs:
agent:
cmd: ["pnpm", "--filter", "agent", "run", "dev"]
cwd: .
color: magenta

array:
cmd: ["pnpm", "--filter", "array", "run", "start"]
cwd: .
color: blue
autorestart: true
depends_on:
- agent

agent:
cmd: ["pnpm", "--filter", "agent", "run", "dev"]
cwd: .
color: magenta
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"dev:agent": "pnpm --filter agent dev",
"dev:array": "pnpm --filter array dev",
"start": "pnpm --filter array start",
"build": "pnpm --filter agent build && pnpm --filter array build",
"typecheck": "pnpm --filter agent build && pnpm --filter agent typecheck && pnpm --filter array typecheck",
"build": "turbo build",
"typecheck": "turbo typecheck",
"lint": "biome check --write --unsafe",
"format": "biome format --write",
"test": "pnpm -r test",
Expand All @@ -33,7 +33,8 @@
"devDependencies": {
"@biomejs/biome": "2.2.4",
"husky": "^9.1.7",
"lint-staged": "^15.5.2"
"lint-staged": "^15.5.2",
"turbo": "^2.6.2"
},
"lint-staged": {
"*.{ts,tsx,js,jsx}": [
Expand Down
16 changes: 5 additions & 11 deletions packages/agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
"require": "./dist/index.js"
}
},
"type": "module",
Expand All @@ -25,8 +25,8 @@
"author": "PostHog",
"license": "SEE LICENSE IN LICENSE",
"scripts": {
"build": "pnpm exec rimraf dist && pnpm exec rollup -c && pnpm exec tsc --project tsconfig.build.json --emitDeclarationOnly",
"dev": "pnpm exec rollup -c --watch",
"build": "tsup",
"dev": "tsup --watch",
"typecheck": "pnpm exec tsc --noEmit",
"example": "tsx example.ts",
"prepublishOnly": "pnpm run build"
Expand All @@ -36,15 +36,9 @@
},
"devDependencies": {
"@changesets/cli": "^2.27.8",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@types/bun": "latest",
"minimatch": "^10.0.3",
"rimraf": "^6.0.1",
"rollup": "^4.24.0",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-typescript2": "^0.36.0",
"tsup": "^8.5.1",
"tsx": "^4.20.6",
"typescript": "^5.5.0"
},
Expand Down
76 changes: 0 additions & 76 deletions packages/agent/rollup.config.mjs

This file was deleted.

7 changes: 2 additions & 5 deletions packages/agent/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import {
type ContentBlock,
ndJsonStream,
PROTOCOL_VERSION,
type RequestPermissionRequest,
type RequestPermissionResponse,
type SessionNotification,
} from "@agentclientprotocol/sdk";
import { POSTHOG_NOTIFICATIONS } from "./acp-extensions.js";
import {
Expand Down Expand Up @@ -643,12 +640,12 @@ Generated by PostHog Agent`;
if (!isPolling) break;

try {
const newEntries = await this.sessionStore!.pollForNewEntries(
const newEntries = await this.sessionStore?.pollForNewEntries(
taskRunId,
lastKnownEntryCount,
);

for (const entry of newEntries) {
for (const entry of newEntries ?? []) {
lastKnownEntryCount++;
// Look for user_message notifications
if (
Expand Down
Loading