Commit Graph

200 Commits

Author SHA1 Message Date
Prateek f6841f37a8 chore: rename @composio scope to @aoagents across all packages
Renames all npm package scopes from @composio/* to @aoagents/* and
updates GitHub repo references from ComposioHQ/agent-orchestrator
to aoagents/ao throughout the codebase.

- All package.json names and dependencies
- README badges, links, and install instructions
- Documentation references
- Changeset config
- Source code imports and test files
2026-04-07 19:59:51 +05:30
Ashish Huddar 48d655d932
fix: reduce dashboard JS bundle from 1.7MB to 170KB (#792) (#928)
* fix: reduce dashboard JS bundle from 1.7MB to 170KB (gzipped) (#792)

Switch `ao start` default from `next dev` (7.6MB uncompressed) to optimized
production builds (128KB per route). Add `--dev` flag for HMR when editing
dashboard UI. Add bundle analyzer, server-only guards, and lazy-load
DirectTerminal via next/dynamic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: skip dashboard rebuild when assets exist, fix CI timeout

Skip the production build step when .next/BUILD_ID and dist-server/
already exist (e.g. after pnpm build in CI). Add c8 ignore for
untestable process-spawning startup code to fix diff coverage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor: adopt PR #903 patterns — centralize rebuild logic and add preflight web artifact checks

Extract rebuildDashboardProductionArtifacts into dashboard-rebuild.ts, add
isInstalledUnderNodeModules/assertDashboardRebuildSupported guards, remove
findProcessWebDir, and verify .next/BUILD_ID + dist-server/start-all.js in
preflight. Dashboard command now always uses production server.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: skip production preflight in --dev mode, add coverage for rebuild helpers

- Skip preflight.checkBuilt() when --dev is passed (dev mode uses HMR,
  doesn't need .next/BUILD_ID or dist-server/start-all.js)
- Add c8 ignore to dashboard.ts process-spawning code (matches start.ts pattern)
- Add tests for rebuildDashboardProductionArtifacts (success, failure, npm guard)
- Add preflight tests for npm-install web artifact hint paths

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: align preflight skip with actual dev-server condition

Only skip production artifact preflight when both --dev is passed AND
we're in the monorepo (where dev mode actually works). For npm global
installs, --dev is silently ignored and production server runs, so
preflight must still validate .next/BUILD_ID and dist-server/start-all.js.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: match @next/bundle-analyzer version to next@^15.1.0

The @next/* packages follow the Next.js release train. Pin the bundle
analyzer to ^15.1.0 to match the project's next dependency.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: correct recovery command for npm installs and remove redundant guard

- Change stale-build recovery suggestion from "ao update" (which only
  works in source checkouts) to "npm install -g @composio/ao@latest"
  for npm global installs
- Remove redundant assertDashboardRebuildSupported call in dashboard.ts
  since rebuildDashboardProductionArtifacts already calls it internally

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 16:12:51 +05:30
Ashish Huddar d8b8645bc7
fix(cli): ao start navigates to session page instead of orchestrator selection (#958)
* fix(cli): ao start navigates to session page instead of orchestrator selection

When ao start finds existing orchestrators, it now auto-selects the most
recently active one and opens /sessions/{id} directly, rather than the
/orchestrators selection page. This matches the behavior users expect:
landing on the agent terminal immediately on startup.

Closes #954

* fix(cli): navigate to session page for single orchestrator, selection page for multiple

When ao start finds existing orchestrators:
- 1 orchestrator: navigate directly to /sessions/{id} (fix for #954)
- 2+ orchestrators: keep /orchestrators?project={id} selection page so users
  can choose among sessions or spawn a new one — the main dashboard only
  links one orchestrator per project, making the selection page the only
  startup path for multi-orchestrator projects.

Addresses review feedback on #958.
2026-04-07 09:48:41 +05:30
Ashish Huddar 30ee327daf
fix(notifier): remove desktop notifications from default configs (#962)
* fix(notifier): remove desktop notifications from all default configs (#960)

Desktop notifications via osascript open blank Finder windows on macOS
without providing useful information. Remove 'desktop' from all default
notifier lists so new users are not affected. Existing configs that
explicitly list 'desktop' continue to work unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(cli): add coverage for autoCreateConfig default notifiers

Line 585 in start.ts (`notifiers: []`) was not covered by the diff
coverage check. Added a test that exercises `autoCreateConfig` via
`createConfigOnly()`, verifying that the generated config does not
include 'desktop' in `defaults.notifiers`.

Required infrastructure additions:
- Mock `node:process` so `import { cwd } from "node:process"` in
  start.ts can be overridden per-test via `mockProcessCwd`
- Set `detectProjectType` mock to return `{ languages: [], frameworks: [] }`
  instead of null to avoid crash in autoCreateConfig

Closes #960

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(config): disable all notifications by default — fully opt-in

Change DefaultPluginsSchema.notifiers default from ["composio"] to []
and notificationRouting defaults to all empty arrays, so no notifications
are sent unless the user explicitly configures them. Addresses reviewer
feedback that composio notifier should not be active out of the box.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(config): use empty object as notificationRouting default

Empty array entries like { urgent: [] } block the ?? fallback in
notifyHuman (lifecycle-manager.ts:1169) because [] is not null/undefined.
Using {} lets unlisted priorities fall back to defaults.notifiers, so
explicit per-user notifier config is respected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 08:59:51 +05:30
Harsh Batheja 9ac659066a
revert: remove model rate-limit pause functionality (PR #367) (#908)
* Revert "fix: pause workers on model limits and stabilize session visibility (#367)"

This reverts commit 003eb78adb.

* fix: resolve post-revert type errors and broken test references

- Fix dangling import { in session-manager.ts (leftover from removing globalPause imports)
- Fix duplicate registerStop body in start.ts (leftover parent-version code after catch block)
- Remove --keep-session flag from stop command (was added by #367)
- Fix PullRequestsPage.tsx useSessionEvents call removing dropped initialGlobalPause arg
- Remove globalPause test cases from spawn.test.ts, communication.test.ts, api-routes.test.ts
- Remove unused updateMetadata imports from test files

* fix: remove unused allSessions variable after globalPause removal
2026-04-06 14:58:41 +05:30
Ashish Huddar 0e3f6c8698 Merge remote-tracking branch 'origin/main' into ashish921998/404-loading-pages 2026-04-06 09:10:23 +05:30
Ashish Huddar 52bcce8f2b feat(web): add dashboard error boundaries 2026-04-06 00:32:53 +05:30
Harshit Singh Bhandari 35eca3107c
Merge pull request #909 from harshitsinghbhandari/fix/prevent-duplicate-orchestrators
fix: prevent ao start from spawning duplicate orchestrators
2026-04-05 22:47:06 +05:30
Ashish Huddar 129149e166 fix(cli): resolve ao-core vitest subpaths 2026-04-05 22:38:55 +05:30
Ashish Huddar 1d30731247 fix(cli,web): stabilize isolated workspace checks 2026-04-05 22:28:12 +05:30
harshitsinghbhandari e2b43ec0b2 fix comments 2026-04-05 18:41:46 +05:30
suraj_markup 86ac556e8e
Merge pull request #864 from yyovil/emdash/fix-ao-version-p0h
fix(cli): ao's version mismatch problem
2026-04-04 23:41:13 +05:30
harshitsinghbhandari a21b97656b fix: correct tmux target fallback and deduplicate orchestrator listing
- Fix tmux target to use session ID when runtimeHandle is missing,
  preventing references to non-existent sessions
- Extract mapSessionsToOrchestrators helper to eliminate duplicate
  orchestrator listing logic between page.tsx and API route

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-04 22:43:11 +05:30
harshitsinghbhandari 25b3f31a1c test: update start command tests for auto-select behavior
Update existing test to verify the new --no-dashboard auto-select
behavior and add a separate test for dashboard-enabled selection
message.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-04 22:10:11 +05:30
harshitsinghbhandari f9abcdf32f fix: auto-select orchestrator when --no-dashboard is used
When --no-dashboard is used and existing orchestrators are found,
auto-select the most recently active one instead of deferring to
dashboard selection (which isn't available). This ensures the CLI
remains usable without the dashboard.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-04 21:57:56 +05:30
harshitsinghbhandari d54ca026c1 fix: wrap session listing in try/catch for proper error handling
The sm.list() call was outside the existing try/catch that handles
orchestrator setup failures. If listing sessions throws, the spinner
could be left running and the dashboard process could leak.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-04 21:56:53 +05:30
harshitsinghbhandari 2a1b513e7d fix tests 2026-04-04 21:52:50 +05:30
harshitsinghbhandari 71bdf75f53 add missing mock list 2026-04-04 19:32:01 +05:30
harshitsinghbhandari 0b7b3153a9 fix: prevent ao start from spawning duplicate orchestrators
When ao start is run and existing orchestrator sessions exist for the
project, the CLI now skips spawning a new one. Instead:

- Detects existing orchestrator sessions before spawning
- Opens the dashboard to a new /orchestrators page for session selection
- Users can resume an existing orchestrator or start a new one

Changes:
- packages/cli/src/commands/start.ts: Check for existing orchestrators,
  redirect to selection page if found
- packages/web/src/app/api/orchestrators/route.ts: Add GET endpoint to
  list orchestrators for a project
- packages/web/src/app/orchestrators/page.tsx: New page for orchestrator
  selection
- packages/web/src/components/OrchestratorSelector.tsx: UI component for
  selecting or spawning orchestrators
- packages/web/src/components/__tests__/OrchestratorSelector.test.tsx:
  Tests for the selector component

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-04 19:05:51 +05:30
Harsh Batheja 34bc5bb2d5
feat: support multiple concurrent orchestrators with isolated worktrees (#870)
* feat: support multiple concurrent orchestrators with isolated worktrees

- Each orchestrator session gets a numbered ID ({prefix}-orchestrator-N)
  and an isolated git worktree, replacing the single shared orchestrator
- reserveNextOrchestratorIdentity atomically reserves the next available
  number and detects conflicting project prefix configurations early
- isOrchestratorSession / isOrchestratorSessionName accept optional
  allSessionPrefixes for cross-project false-positive prevention
- getProjectPause and resolveGlobalPause track the longest active pause
  across all concurrent orchestrators instead of returning the first found
- cleanupWorktreeAndMetadata helper used consistently on all failure paths
  including post-launch; system prompt file included in cleanup
- pollBacklog, status.ts, ProjectSidebar, sessions page, global-pause,
  project-utils, serialize, and sessions API route all pass
  allSessionPrefixes to isOrchestratorSession
- Web sessions/[id]/page.tsx fetches project prefix map and passes it
  through prefixByProjectRef to avoid stale closure in fetchProjectSessions

* fix: seed sseAttentionLevels from fresh sessions on full refresh

When scheduleRefresh dispatches a reset action, derive sseAttentionLevels
from the freshly fetched sessions using getAttentionLevel. This clears
phantom entries for removed sessions and seeds correct levels for new
sessions, preventing stale favicon color and attention counts until the
next SSE snapshot.

* fix: merge duplicate @/lib/types imports into single import statement

Combining the separate import type and value import from @/lib/types
into one import to satisfy the no-duplicate-imports lint rule.
2026-04-04 12:30:51 +05:30
harshitsinghbhandari ddba72a485 Merge branch 'main' of https://github.com/ComposioHQ/agent-orchestrator into feat/736 2026-04-03 02:40:53 +05:30
harshitsinghbhandari 9a3a18b2c7 performed review and fixed 2026-04-03 01:23:37 +05:30
harshitsinghbhandari add74f1a46 fix: handle optional plugin field in CLI and web packages
Update all usages of project.tracker.plugin and project.scm.plugin
to use optional chaining since the plugin field is now optional
when package or path fields are specified.

Files updated:
- CLI: doctor.ts, status.ts, verify.ts
- Web: issues/route.ts, verify/route.ts, scm-webhooks.ts,
       serialize.ts, services.ts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-02 19:19:44 +05:30
Your Name 9e78fe3b23 fix: resolve prompt delivery persistence and false warnings 2026-04-02 17:41:46 +05:30
yyovil b5018998db refactor CLI version wiring for diff coverage
Extract getCliVersion and createProgram so the version-path changes are covered by the PR Diff Coverage workflow.
2026-04-02 17:34:19 +05:30
Your Name feecc6f177 fix: robust prompt delivery with retries and CLI warnings 2026-04-02 17:27:53 +05:30
yyovil 76b5e42c6f added missing tests for added loc 2026-04-02 01:02:28 +05:30
yyovil 2b8c7e8d9a Reverted back to createRequire method instead of static imports in ESM because of compatibility issues with node < v20.10.0 2026-04-02 00:10:01 +05:30
Yyovil c4cd7c7098
Apply suggestion from @Copilot
node16 will do the trick

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-01 23:37:37 +05:30
yyovil 58266a96e3 Fixed ao's version mismatch problem 2026-04-01 22:30:22 +05:30
ChiragArora31 4d33d25126 fix: detect nested project directories in CLI auto-resolution 2026-04-01 18:28:57 +05:30
Dhruv Sharma 2febded969
Merge pull request #836 from ChiragArora31/feat/status-watch-mode
feat(cli): add watch mode to ao status
2026-04-01 12:28:32 +05:30
ChiragArora31 10a41cfafa fix(cli/status): validate --interval only when --watch is used
The --interval flag is only relevant when --watch is enabled.
Previously, passing `--interval 0` without `--watch` threw an error,
whereas `--interval 5` was silently ignored. Now, invalid intervals
are ignored when `--watch` is omitted, ensuring consistent behavior.

Also adds a test case to prevent regression.
2026-04-01 11:05:30 +05:30
ChiragArora31 5a186fbb7f test(cli/status): add tests to hit 80% diff coverage threshold
Cover the following previously-uncovered lines in status.ts:
- 65-69: maybeClearScreen() isTTY branch
- 255-256: maybeClearScreen() call on watch refresh (refreshing=true)
- 262-266: loadConfig() throw → fallback to tmux session discovery
- 269-271: unknown --project flag → process.exit(1)
- 388, 390-396, 398: tracker block (registry.get, listIssues, error catch)
- 402-405: unverified issues warning banner
- 424-436: setInterval guard skips render when already in progress

Also hoists mockGetPluginRegistry as a vi.fn() so individual tests
can override the plugin registry returned by getPluginRegistry.
2026-04-01 10:37:12 +05:30
ChiragArora31 70232baf29 fix(cli): clean up status watch timer on shutdown 2026-04-01 09:27:38 +05:30
ChiragArora31 2d6bc7671d feat: add watch mode to status command 2026-04-01 09:26:59 +05:30
ChiragArora31 4420ab1773 feat(cli): add plugin resolution checks to ao doctor 2026-04-01 06:39:14 +05:30
Dhruv Sharma 7d7fb92d7b
Merge pull request #837 from fireddd/ci/diff-coverage-threshold
ci: add diff coverage workflow enforcing 80% on changed code only
2026-03-31 20:58:33 +05:30
Dhruv Sharma 124f7d30ee Merge main into feat/openclaw-dx - resolve conflicts
Conflicts resolved in 3 files:
- plugin-marketplace.ts: take main's createRequire approach, keep isAbsolute fix
- plugin-scaffold.ts: take main's newline escaping (superset of backslash fix)
- plugin.test.ts: take main's importOriginal pattern

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 20:05:16 +05:30
Dhruv Sharma 1701e03aac
Merge pull request #833 from ComposioHQ/feat/plugin-marketplace
Feat/plugin marketplace
2026-03-31 20:01:39 +05:30
Harsh Batheja 66aa92aec0
fix: use pnpm dev in monorepo to start terminal WebSocket servers (#846)
In dev mode, `npx next dev` only starts Next.js without the terminal
WebSocket servers. Detect monorepo by checking for `server/` dir and
use `pnpm run dev` which runs both via concurrently.
2026-03-31 19:13:49 +05:30
Dhruv Sharma fe1d45b0a7 fix: address production failure modes from adversarial review
- Rollback plugin config on setup failure so a half-configured
  notifier is never left enabled (non-transactional install fix)
- Use atomic temp+rename for health summary writes to prevent
  corruption under concurrent notifications
- Scope credential injection to only when OpenClaw notifier is
  configured, avoiding ambient secret exposure to unrelated projects

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 14:39:49 +05:30
Dhruv Sharma 166ace7477 refactor: extract fetch timeout into named constant
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 14:38:28 +05:30
Dhruv Sharma 6cfb1cc864 fix: guard statSync against permission errors, add fetch timeout
- Wrap statSync in try/catch in resolveLocalPluginEntrypoint so
  permission-denied errors return null instead of crashing
- Add 30s AbortSignal timeout to refreshMarketplaceCatalog fetch
  to prevent indefinite hangs on slow networks

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 14:37:52 +05:30
Dhruv Sharma d36c0947cf refactor: deduplicate plugin resolution logic between core and CLI
Export isPluginModule, normalizeImportedPluginModule,
resolvePackageExportsEntry, and resolveLocalPluginEntrypoint from
@composio/ao-core and import them in the CLI instead of maintaining
independent copies that have already diverged.

Removes ~70 lines of duplicated code from plugin-marketplace.ts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 13:53:30 +05:30
Dhruv Sharma 153c298a46 fix: resolve plugin-registry.json from package root
createRequire resolves relative to the compiled dist/lib/ directory
where the JSON file doesn't exist. Use readFileSync with a path
resolved from the package root (../../src/assets/) which works from
both src/lib/ and dist/lib/.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 13:45:54 +05:30
fireddd e6c3a06427 ci: add diff coverage workflow enforcing 80% on changed code only
Uses diff-cover to check that newly added or modified lines in PRs
have at least 80% test coverage, without requiring the entire
codebase to meet the threshold.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 09:26:36 +05:30
Dhruv Sharma 6930f2ee12 fix: use createRequire for JSON import (Node16 module compat)
Import attributes aren't supported with module: "Node16". Switch to
createRequire for the plugin-registry.json import and copy assets
to dist during build.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 05:11:24 +05:30
Dhruv Sharma 2c0a32da24 fix: use createRequire for JSON import (Node16 module compat)
Import attributes (`with { type: "json" }`) require module >= node18.
Use createRequire instead since tsconfig targets Node16.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 05:10:50 +05:30
Dhruv Sharma 545bede0b4 fix: add JSON import attribute for Node.js 20 compatibility
Add `with { type: "json" }` to the plugin-registry.json import to
satisfy Node.js 20's ERR_IMPORT_ASSERTION_TYPE_MISSING requirement.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 05:08:13 +05:30