Commit Graph
99 Commits
Author SHA1 Message Date
ZacharyZhang-NY b4e17cbd35 Fail runs whose first turn carries no text and no tool calls
A reasoning-heavy model can burn the whole max_tokens budget on
thinking blocks; the parsed turn then has neither text nor tool calls
and the loop treated it as a successful completion, marking a run done
when nothing happened. Such a first turn now fails the run so the
failure is visible and the heartbeat retries; later empty-text turns
after real tool work still complete normally.
2026-06-09 21:22:44 -04:00
ZacharyZhang-NY d6d6656428 Make the hire_agent department contract explicit
The CEO's first run hired five reports into departments "general" and
"engineering"; the hiring-policy lookup was exact-match against the
seeded names (Executive, Engineering, ...), so every hire failed and
the kickoff produced nothing. The tool schema now enumerates the
canonical departments, the policy lookup matches case-insensitively
and stores the canonical name on the agent, and an unknown department
error lists the valid choices so the model can self-correct.
2026-06-09 21:21:01 -04:00
ZacharyZhang-NY 2dd4f3976a Enforce deadlines across the whole provider request lifecycle
The abort timer was cleared as soon as fetch resolved with headers, so
a server that stalled the response body hung the request forever - and
one hung run froze the autonomous queue behind the worker re-entrancy
guard. JSON requests now carry a header deadline plus a longer body
deadline on one abort controller, and event streams fail when no chunk
arrives within an idle window, cancelling the reader. Timeouts surface
as ProviderHttpError so the run records a clear failure and the
heartbeat retries.
2026-06-09 21:18:51 -04:00
ZacharyZhang-NY f15ed8cb6f Recover interrupted runs and requests at boot
A task_run still marked running at startup has no executor - the
single-instance app that owned it is gone - yet nothing failed it, the
queue worker only claims queued rows, and the heartbeat excludes tasks
with a running run, so one interrupted shutdown wedged the company
forever. Boot now fails orphaned running runs and their in-flight
foreground provider requests (auditably), which hands the task back to
the heartbeat for an automatic retry. Background provider requests are
untouched; the background worker resumes those by external id.
2026-06-09 21:16:42 -04:00
ZacharyZhang-NY 4e47da4d6b Route goal kickoffs through task policy and revive waiting goals on hire
Adversarial review of the kickoff feature surfaced two gaps. First, the
kickoff task was inserted with raw SQL, so a workspace-bound kickoff
carried requires_filesystem without the execution approval every other
task receives - manual runs failed and review-mode orgs had no approval
trail. Kickoffs (in-app and onboarding) now go through createTask and
its policy gates. Second, a goal created before any agent existed
stayed inert forever; creating an agent now operationalizes every
active goal that has no task yet. Goal owners must be active agents:
an archived owner falls back to the top-level agent and the owner
dropdown only offers active agents.
2026-06-09 20:38:35 -04:00
ZacharyZhang-NY a65347b91f Cut governance bureaucracy from settings and sidebar
Settings shrinks from 14 tabs to the five that serve the product:
Workspace, Billing, Providers, Skills, Migration. The deleted panels
(Members/IAM, Models, Policies, Operations, SDLC, Compliance, Profile,
Notifications, Security) were read-only governance tables and raw
audit-log dumps with no old-app counterpart. The Automation page goes
too: its rules stored empty conditions and no engine ever executed
them. Sidebar reordered to match the old app hierarchy (Home, Inbox,
Work, Approvals first). Backend services and schema are untouched.
2026-06-09 20:07:28 -04:00
ZacharyZhang-NY 3704cec19b Kick off goal execution when a goal is created
A goal created from the Work page only wrote a goals row; nothing ever
read it, so the company never started working on it. Creating a goal now
produces an "Operationalize goal" kickoff task for the chosen owner (or
the top-level agent when unowned) and re-enables that agent's heartbeat,
so the autonomous queue worker starts the run - the same activation
contract the previous runtime had via goal_activated wakes and CEO
bootstrap. Onboarding shares the same kickoff module instead of its own
copy.
2026-06-09 20:03:09 -04:00
ZacharyZhang-NY ed9b3a3dd1 Add meetings, sprints, and approval decision notes
Migration 042 creates meetings and sprints tables, adds decision_notes
to approvals. Full-stack: MeetingService, SprintService, IPC channels,
preload bridge, domain types. UI: MeetingsPage with scheduling and
type filtering, SprintsPage with progress tracking, ApprovalDetailDialog
with decision notes textarea.
2026-06-07 18:01:58 -04:00
ZacharyZhang-NY 75e5d17a86 Implement full task inspector with subtasks, activity, and inline edit
Migration 041 adds parent_task_id to tasks for subtask hierarchy.
TaskDetailDialog now has three tabs: Overview (description, assignee,
project, goal, workspace, runs with error messages), Subtasks (child
tasks with status), and Activity (audit events and approval history).
Inline edit overlay covers title, description, assignee, risk, priority,
and parent task. Task delete is available from the dialog footer.
2026-06-07 17:55:59 -04:00
ZacharyZhang-NY b5b8f3ba3c Add document, knowledge, and automation subsystems
Migration 040 creates documents, knowledge_entries, and automation_rules
tables. Full-stack services (DocumentService, KnowledgeService,
AutomationService), IPC handlers, preload bridge, desktop-api types,
and domain records wired into the snapshot. UI pages follow next.
2026-06-07 17:46:55 -04:00
ZacharyZhang-NY abe578b1a0 Harden provider security and build dependencies 2026-06-07 14:04:32 -04:00
ZacharyZhang-NY d5a7665893 Create project collaboration surface 2026-06-07 13:41:53 -04:00
ZacharyZhang-NY 3f34d1cf65 Create runnable agents from hire form 2026-06-07 13:37:36 -04:00
ZacharyZhang-NY 8eec454927 Queue agent runs from chat mentions 2026-06-07 13:34:27 -04:00
ZacharyZhang-NY ab546f822d Enable autonomous file handoffs 2026-06-07 13:25:28 -04:00
ZacharyZhang-NY 6f23ac2877 Route agent messages to department channels and thread hand-offs between agents 2026-05-30 10:50:36 -04:00
ZacharyZhang-NY 35e1097041 Let custom OpenAI/Anthropic-compatible providers take a hand-entered model id 2026-05-30 02:06:04 -04:00
ZacharyZhang-NY 2dbab2c1fe Use a free-text model id for providers without an enumerable model list 2026-05-30 01:27:38 -04:00
ZacharyZhang-NY d4ace283d1 Gate the model picker behind credentials: fetch on Get models or after OAuth login 2026-05-30 01:05:14 -04:00
ZacharyZhang-NY cc876e6e16 Fetch live provider model lists instead of the hardcoded catalog 2026-05-30 00:51:42 -04:00
ZacharyZhang-NY c6e29d7fbe Make organization deletion cascade through credentials and immutable audit logs 2026-05-30 00:13:24 -04:00
ZacharyZhang-NY e14a4bfce8 Let agents post coordination messages so company channels are populated 2026-05-29 23:35:33 -04:00
ZacharyZhang-NY 54ad9d1909 Register agent deliverables as file objects so they appear on the Files page 2026-05-29 23:31:53 -04:00
ZacharyZhang-NY e7fa60d6b6 Auto-approve agent work in AI CEO mode instead of gating on the operator 2026-05-29 23:27:37 -04:00
ZacharyZhang-NY 4d2425dde0 Run the agent loop on Azure, Bedrock and Vertex too
Every catalog provider can now drive agent execution:
- Azure OpenAI -> Chat Completions at the deployment URL with api-key
- AWS Bedrock -> Converse API signed natively with SigV4 (node:crypto)
- Vertex AI -> Gemini generateContent with a service-account JWT (RS256)
  exchanged for a cached access token

The credential resolver maps each cloud profile to the turn's needs; the router
covers all 16 providers. Pure encoders, the SigV4 signer and the GCP auth are
unit-tested; no AWS/GCP SDK dependency.
2026-05-29 22:43:42 -04:00
ZacharyZhang-NY 6c68836455 Add custom OpenAI- and Anthropic-compatible providers
New 'Custom OpenAI-compatible' and 'Custom Anthropic-compatible' providers let
an agent run against any compatible endpoint by base URL + key: the turn posts
Chat Completions (/chat/completions) or Anthropic Messages (/v1/messages) at the
configured base URL. Backfilled into existing orgs by migration 037.
2026-05-29 22:36:56 -04:00
ZacharyZhang-NY 937fdfa23f Run the agent loop on every provider, not just API keys
The loop was gated to API-key providers, so a GPT-account (Codex) CEO failed
with 'requires an API-key provider'. Port Pi's actual request handlers natively
so every agent-capable provider runs:
- chat-completions turn for xAI, Groq, Mistral, Cerebras, OpenRouter
- Codex SSE Responses for GPT account
- Anthropic-OAuth (Claude Code system + beta headers) for Claude Pro/Max
- Copilot proxy (baseUrl from the token) for GitHub Copilot
- Gemini Code Assist for Google Antigravity

A credential resolver refreshes expired OAuth access tokens at request time and
persists the rotation; the runner routes by provider key and passes the resolved
credential. The heartbeat now retries failed tasks (bounded to 3 attempts) so a
run that failed on the old gate recovers automatically. Cloud providers
(Azure/Bedrock/Vertex) still report a clear unsupported message.
2026-05-29 22:22:24 -04:00
ZacharyZhang-NY 61f2162236 Wake CEO-hired agents via heartbeat so delegated tasks run autonomously
The queue worker now also enqueues one run per actionable assigned task of a
heartbeat-enabled agent with an enabled provider and no run yet, so after the
CEO hires and delegates, its reports start their tasks on their own. Each task
is enqueued at most once. The team-building prompt is now scoped to managers
(no manager) with an empty team, so reports execute their task instead.
2026-05-29 21:12:09 -04:00
ZacharyZhang-NY 0575712e02 Run the CEO agent autonomously with a real tool-use loop
The new app reached a real LLM but never ran an agent: the kickoff task_run
sat queued forever and runTask was a single text completion with no tools.

This adds the missing runtime:
- provider-tool-turn: OpenAI Responses + Anthropic Messages tool-use turns
- agent-tools + deliverable-writer: hire_agent, create_task,
  update_task_status, write_deliverable (workspace-scoped, traversal-safe)
- agent-run-loop: real tool-use loop, capped iterations
- task-queue-worker: claims queued runs in a transaction and executes them

task-execution now drives the loop; a background worker auto-runs the
bootstrap CEO run so it hires its team, delegates tasks, and writes the first
deliverable into the bound workspace. Autonomy is gated by AGENTCOMPANY_NEW_AUTORUN
(tests run with it off to stay hermetic).
2026-05-29 21:08:04 -04:00
ZacharyZhang-NY 9ce1281054 Add Claude Pro/Max, Mistral, Cerebras and OpenRouter connectors
Closes the Anthropic OAuth gap with a native Claude Pro/Max device sign-in
(reusing the OAuth engine) and adds three OpenAI-compatible API-key
providers. Model lists are sourced from the provider registry. A backfill
migration seeds the new providers into existing organizations idempotently.
2026-05-29 20:19:01 -04:00
ZacharyZhang-NY 49a9f16221 Replace token-paste with native device-code/PKCE provider sign-in
Implement the official OAuth login flows natively (ported from pi-ai's
reference): GitHub Copilot device-code, GPT account (ChatGPT Codex) and
Google Antigravity authorization-code + PKCE via a loopback callback server.
Obtained credentials are stored as JSON through the existing secret vault.
Onboarding and Settings now run the real sign-in instead of pasting an
access token.
2026-05-29 20:08:55 -04:00
ZacharyZhang-NY 1cda873cb5 Render audit events as readable labels instead of raw codes 2026-05-28 22:43:33 -04:00
ZacharyZhang-NY c43f29299f Route collaboration slash commands 2026-05-23 23:21:00 -04:00
ZacharyZhang-NY 7c978c6a10 Strengthen file scan evidence 2026-05-23 23:16:40 -04:00
ZacharyZhang-NY 9cc4c3b44a Scope task run isolation 2026-05-23 23:09:13 -04:00
ZacharyZhang-NY 648544114a Record provider auth sessions 2026-05-23 23:03:09 -04:00
ZacharyZhang-NY 216d485c58 Run skill revision tests 2026-05-23 22:56:06 -04:00
ZacharyZhang-NY 16855b696a Resolve migration reconciliation items 2026-05-23 22:46:50 -04:00
ZacharyZhang-NY 971bdd95e6 Resolve skills during task execution 2026-05-23 22:42:39 -04:00
ZacharyZhang-NY ddd3b09bd1 Redact employee references during GDPR delete 2026-05-23 22:38:31 -04:00
ZacharyZhang-NY 689fe861f1 Make audit events immutable 2026-05-23 22:35:35 -04:00
ZacharyZhang-NY 20c8ef6ef3 Record browser action evidence metadata 2026-05-23 22:33:33 -04:00
ZacharyZhang-NY de90d6e944 Audit provider sign-in launches by employee 2026-05-23 22:20:16 -04:00
ZacharyZhang-NY 335d57b77f Scope provider requests to workspaces 2026-05-23 22:16:37 -04:00
ZacharyZhang-NY ee5eff7725 Execute approval decisions from chat slash commands 2026-05-23 22:08:38 -04:00
ZacharyZhang-NY 5b68c629c4 Block GDPR delete through related holds 2026-05-23 22:03:42 -04:00
ZacharyZhang-NY e78e9a8aa0 Audit chat message mutations 2026-05-23 21:59:16 -04:00
ZacharyZhang-NY c59be97b79 Gate task execution on approval source refs 2026-05-23 21:52:52 -04:00
ZacharyZhang-NY 4dbd8997c0 Add file handoff audit records 2026-05-23 21:45:49 -04:00
ZacharyZhang-NY babbf07cb2 Add migration validation summary gate 2026-05-23 21:35:21 -04:00