Commit Graph
839 Commits
Author SHA1 Message Date
ZacharyZhang-NY 810e2d5967 update 2026-05-15 19:40:20 -04:00
ZacharyZhang-NY 2ab001b18a fix(security): require https for trusted links 2026-05-15 02:56:25 -04:00
ZacharyZhang-NY 4e5af2b45f fix(settings): guard disabled model reads 2026-05-15 02:53:13 -04:00
ZacharyZhang-NY 0a107af014 fix(security): omit agent token fingerprints 2026-05-15 02:49:40 -04:00
ZacharyZhang-NY c20d3942a8 fix(security): sanitize credential test logs 2026-05-15 02:44:50 -04:00
ZacharyZhang-NY b92cf62c4c fix(data): canonicalize operation json fields 2026-05-15 02:36:19 -04:00
ZacharyZhang-NY 10c1f6d103 fix(api): preserve meeting patch fields 2026-05-15 02:25:24 -04:00
ZacharyZhang-NY 9d4af15d4b fix(browser): limit retained action screenshots 2026-05-15 02:21:16 -04:00
ZacharyZhang-NY b5a6a1a9ea fix(browser): settle timed out actions 2026-05-15 02:17:10 -04:00
ZacharyZhang-NY 83faa9629b fix(security): gate landing dependency audit 2026-05-15 02:12:47 -04:00
ZacharyZhang-NY 0c85dc3d32 fix(security): patch landing dependency audit 2026-05-15 02:03:34 -04:00
ZacharyZhang-NY d76040af78 fix(security): patch root dependency audit 2026-05-15 01:59:58 -04:00
ZacharyZhang-NY 7b54fe54a8 fix(security): materialize complete skill packages 2026-05-15 01:36:16 -04:00
ZacharyZhang-NY f5b3de438e fix(security): limit skill URL import reads 2026-05-15 01:18:44 -04:00
ZacharyZhang-NY 0cbaabf937 fix(security): bound skill URL redirects 2026-05-15 01:07:43 -04:00
ZacharyZhang-NY 6ae506bf73 fix(security): preserve SNI for skill URL fetches 2026-05-15 01:04:41 -04:00
ZacharyZhang-NY 254ee7c8d8 fix(security): validate credential payload reads 2026-05-15 00:57:23 -04:00
ZacharyZhang-NY 8b0b06f765 fix(security): validate bedrock endpoint URLs 2026-05-15 00:52:18 -04:00
ZacharyZhang-NY 84b92c859e fix(security): restrict local connector endpoints 2026-05-15 00:43:45 -04:00
ZacharyZhang-NY fa19e95f19 fix(security): inject provider env into model streams 2026-05-15 00:35:55 -04:00
ZacharyZhang-NY 66e24b1060 fix(security): scope managed path opening 2026-05-15 00:26:20 -04:00
ZacharyZhang-NY bde35c3518 fix(security): scope social account references 2026-05-15 00:15:37 -04:00
ZacharyZhang-NY 51d468e4c3 fix(security): scope work product creation 2026-05-15 00:00:04 -04:00
ZacharyZhang-NY d1a3d23c70 fix(security): scope skill assignments by company 2026-05-14 23:37:58 -04:00
ZacharyZhang-NY 41e1dec647 fix(security): enforce company scoped updates 2026-05-14 23:28:29 -04:00
ZacharyZhang-NY fccb0d8586 fix(runtime): serialize Fire Pass calls per credential to stop boss-build 429s
Boss build seeds one Fire Pass key for every agent. Three concurrent
agents -> three concurrent streamSimple calls against the Kimi K2.6
Turbo router -> three HTTP 429s on the overview dashboard.

Add an in-memory async semaphore keyed by (provider, sha1(apiKey)) and
acquire a slot inside `createSafePiStream` before invoking the source.
The slot is released when the stream finishes, errors, or aborts.
`fireworks-firepass` is capped at 1 concurrent call; every other
provider stays uncapped (no fallback layer, no 429 retry — flow control
prevents the burst at the source instead of recovering after).

Same code path applies to public and boss builds: only the seeded key
differs, the gate behaviour is identical.
2026-05-14 22:31:01 -04:00
ZacharyZhang-NY a532120649 feat(connectors): add Ollama and LM Studio as a local auth kind
Both servers expose OpenAI-compatible /v1/chat/completions and /v1/models,
so we route them through pi-ai's `openai-completions` API the same way
Fireworks does — but with a per-installation base URL the user enters
during onboarding instead of a hardcoded one. The shared schemas grow a
`local` credential payload carrying just the baseUrl; the credential
resolver surfaces it on `ResolvedCredential.baseUrl`, the runtime bridge
forwards it through `prepareRun`, and the worker plumbs it into
`resolveModel` so the streamed Model<openai-completions> targets the
user's server. The local-cost path short-circuits to zero in cost-writer
since users bill their own hardware, and the live model list is fetched
from the saved baseUrl by `fetchLocalConnectorModels` (Ollama and LM
Studio both speak the standard OpenAI catalog shape). Onboarding ships
a new LocalProviderCard and the Settings panel a LocalForm; both default
to the catalog's per-connector localhost URL and accept any custom URL.
2026-05-14 14:55:38 -04:00
ZacharyZhang-NY 07d9c00fab feat(connectors): upgrade Fire Pass router to Kimi K2.6 Turbo
Fireworks rolled out the kimi-k2p6-turbo router as the new Fire Pass
target; the k2p5-turbo route will start refusing Fire-Pass-only
callers. Bump the router id and display name in connector-catalog,
apikey connector definition, model-resolver, and capability-seed so
the desktop catalog, the renderer's onboarding rail, the capability
matrix, and the runtime model resolver all point at the same model.
2026-05-14 14:39:32 -04:00
ZacharyZhang-NY 0e1710065f fix(messaging): self-read receipt at send time so authors don't inflate unread counts
agent_message_reads is the per-viewer source of truth for readAt, but
the send path never recorded the author's own receipt. Every message
the board operator or an agent sent therefore counted as unread to
themselves until they happened to re-open the channel — sidebar badge,
inbox panel, and the channel sidebar all derive from the same join
table. Insert a (message_id, from_agent_id, created_at) row in the
same transaction as the message itself; the receipt becomes an
atomic part of the write rather than a deferred maintenance task.
2026-05-14 14:36:10 -04:00
ZacharyZhang-NY 2b4b8d987e fix(worker): always ack run completion to avoid leaking the active map
handleRunFinished and releaseCompletedRunWorkspaceLock both run between
receiving run-finished and posting run-completion-ack. If either throws,
the ack is skipped and the worker keeps the agent in its `active` map
forever; every subsequent wake then queues behind an `isAgentBusy` check
that never clears, and manual wakes from the UI silently fail to start.
Wrap the post-finalize work in try/catch so the ack is posted
unconditionally and the worker state machine stays consistent.
2026-05-14 14:34:16 -04:00
ZacharyZhang-NY 5014ab9651 fix(budget): Fire Pass is unlimited subscription, restore $0 cost
Fireworks Fire Pass is a flat-rate subscription with unlimited tokens.
Per-token cost tracking is inapplicable — restore {input: 0, output: 0}.
2026-04-29 20:43:43 -04:00
ZacharyZhang-NY 158d19c9be fix(budget): add cost fallback for all zero-pricing providers
Pi-ai ships $0 pricing for github-copilot (25 models), google-gemini-cli
(6 models), zai (13 models), and kimi-coding (2 models). This made cost
tracking produce $0 for every run through these providers, rendering
budget enforcement useless.

Added resolveModelCostFallback() in model-resolver.ts with two strategies:
1. Cross-provider lookup: subscription providers (github-copilot,
   google-gemini-cli) use the same models as their API counterparts.
   Look up the model in anthropic/openai/google/xai catalogs using
   normalized ID matching (dots→hyphens) to find real pricing.
2. Per-provider fallback: API-key providers with no cross-provider
   equivalent (zai, kimi-coding) get a static per-provider cost.

CostWriter now calls resolveModelCostFallback after resolveModel, so
all consumers get patched pricing without touching the pi-ai library.
2026-04-29 20:40:05 -04:00
ZacharyZhang-NY 7a78a34558 docs: add domain glossary and agent skill configuration
- CONTEXT.md: domain glossary with 20+ terms, relationships, example
  dialogue, flagged ambiguities, and known issues from grill-with-docs
- docs/agents/: issue tracker (GitHub), triage labels (defaults), and
  domain doc layout (single-context) for engineering skills
- CLAUDE.md: append Agent skills section pointing to docs/agents/
- .gitignore: whitelist CONTEXT.md and docs/agents/*.md
2026-04-29 20:32:22 -04:00
ZacharyZhang-NY db3cd3c8b8 fix(budget): add Fireworks model pricing and auto-unpause after limit increase
Three fixes for the non-functional budget system:

1. Fireworks models hardcoded cost {input: 0, output: 0}, making all
   Fireworks/Fire Pass runs report $0 and budget enforcement useless.
   Added per-model pricing to FIREWORKS_CURATED_MODELS with a fallback
   for unknown models. Pi-ai known providers (Anthropic, OpenAI, etc.)
   already had correct per-model pricing via getModels().

2. saveAgent IPC handler passed the form's submitted status through
   without checking whether the agent was budget-paused and the new
   budget exceeds spent. Now auto-resolves paused → idle when the user
   raises budget_monthly_usd above spent_monthly_usd.

3. checkAutoResolve in budget-enforcement-service resolved policy
   incidents but never touched agents.status. Added
   unpauseBudgetBlockedAgents() that scans for paused agents whose
   legacy budget now has headroom and flips them to idle.
2026-04-29 20:31:48 -04:00
ZacharyZhang-NY b3da6dbf8a fix(messaging): preserve conversation channel in agent replies
Agents always replied with channel="direct" regardless of the original
message's channel, creating new DM conversations instead of replying
in the existing group chat (department/company/project/incident).

Root cause: three layers of the system guided agents toward direct-only
replies:
1. Prompt instructions (wake-reasons, IC/manager operating instructions)
   hardcoded channel="direct" and toAgentId=fromAgentId for all replies
2. Standup API omitted toAgentId from unread messages, removing context
   about who the original message was addressed to
3. Inbox projection contained no reply-routing metadata, so the agent's
   LLM had no signal about which channel to respond in

Fixes:
- routes-agents-standup.ts: include toAgentId in unread message payload
- wake-reasons/en.ts: differentiate direct vs group channel reply format
- operating-en.ts: same channel-preserving guidance for IC and manager
- inbox-projection.ts: embed reply-to routing context in message header
  so the LLM sees channel + target alongside the message body
2026-04-29 20:25:18 -04:00
ZacharyZhang-NY 1e36259c5d fix(orchestration): enforce approval gates on heartbeat and recovery paths
The heartbeat path (canRunAgent → startAgentHeartbeatRun) only checked
isAgentPendingApproval (hire gate), completely bypassing plan_review,
draft_review, strategy_review and other blocking approval types. Agents
in Co-Founder mode continued running despite pending approvals.

Root cause: task-runner.prepareTaskRun had the full getBlockingApproval
check, but heartbeat runs never went through prepareTaskRun — they
created runs directly, skipping the approval gate entirely.

Three fixes:
- heartbeat.canRunAgent: add getBlockingApproval(companyId, agentId, null)
  for agent-level blocking approvals
- heartbeat.startAgentHeartbeatRun: add getBlockingApproval with task id
  after task resolution, before run creation
- task-runner.resumeQueuedRuns: add getBlockingApproval check so app
  restart does not dispatch runs past pending approvals

Also replaced the hardcoded type list in hasPendingReviewApprovalForAgent
with a dynamic join on approval_policies.blocks_execution, eliminating
the sync risk when new blocking approval types are added.
2026-04-29 20:17:33 -04:00
ZacharyZhang-NY c9deca5454 fix(database): project only live active runs 2026-04-29 00:10:23 -04:00
ZacharyZhang-NY 7504df170e fix(worker): harden run completion boundary 2026-04-29 00:04:00 -04:00
ZacharyZhang-NY e34503df68 fix(orchestration): drain queued recovery blockers 2026-04-28 23:47:02 -04:00
ZacharyZhang-NY 7dbaaf0022 fix(worker): recover tasks after worker crash 2026-04-28 23:37:24 -04:00
ZacharyZhang-NY d3e108ec18 fix(scheduler): respect heartbeat eligibility for task cadence 2026-04-28 23:21:25 -04:00
ZacharyZhang-NY d9fd231be3 fix(approvals): make revision requests checkoutable 2026-04-28 23:17:12 -04:00
ZacharyZhang-NY 49ea508ee1 fix(scheduler): drain pending wakeup requests 2026-04-28 20:26:29 -04:00
ZacharyZhang-NY 749ad3a231 fix(scheduler): wake agents with assigned todo work 2026-04-28 20:16:08 -04:00
ZacharyZhang-NY bdfada7549 update 2026-04-24 23:08:12 -04:00
ZacharyZhang-NY 7359aa0a48 release: 0.4.179 2026-04-24 11:31:43 -04:00
ZacharyZhang-NY 369c296f3b update 2026-04-24 10:48:25 -04:00
ZacharyZhang-NY 31aac7c0de fix(messages): normalize escaped markdown newlines 2026-04-24 10:35:11 -04:00
ZacharyZhang-NY 6ce7e63c71 fix(renderer): simplify sidebar and reset page errors 2026-04-24 10:08:07 -04:00
ZacharyZhang-NY eabd304a45 fix(database): normalize baseline schema ddl 2026-04-24 09:39:44 -04:00