Commit Graph

43 Commits

Author SHA1 Message Date
-Puter
359d9e2285 feat: add durable AgentOS slice execution 2026-07-28 14:50:45 +05:30
-Puter
a8d946b6a9 Slice 4 control-plane repairs, lint/catalog cleanup, Flue adapter fixes
Convex control plane (Slices 1-4 prerequisites for Slice 5):
- Versioned Definition/Design persistence: revisions preserve history
  instead of deleting prior slices/approvals
- Fenced conversation turn queue: attempt-numbered leases prevent stale
  worker overwrites; expired turns reconciled by cron
- Fenced Run/Attempt claiming: only queued attempts from running Runs can
  be claimed; lease expiry checks on every finish/checkpoint
- Multi-slice progression: successful slice marks next slice ready instead
  of completing the whole Work; completed Runs blocked from retry
- Typed AttemptClassification in schema and resolver decisions table
- Durable resolver decisions for normal outcomes, cancellation, and
  lease-expiry recovery
- Persistent artifacts and delivery metadata with provenance, source
  revision, verification status, and controlled delivery transitions
- High-impact open questions block definition approval
- Question submission gated to defining/awaiting-approval states only
- Delivery status updates validate JSON metadata before persisting
- Planner failures recorded as durable blocked events
- Approval identity uses canonical tokenIdentifier

Primitives:
- decodeDefinition separates decode from validate
- Design validation enforces 1-4 slices with unique IDs and valid deps
- Artifact and delivery draft schemas with verified-revision binding
- Delivery status transition table

Package management:
- Consolidated shared deps into single catalog (hono, valibot, streamdown,
  @types/react, @types/node, @tailwindcss/*, react-native)
- Removed cross-version Hono boundary: flue() exported as Fetchable
- Deleted bun.lock and regenerated from clean catalog resolution

Lint/format:
- Removed .eslintignore; oxc uses native ignorePatterns in oxlint.config.ts
- Deleted redundant packages/backend/.oxlintrc.json
- Added repos/** and scripts/** to ignore patterns
- Convex-specific rule overrides for ES2022 target constraints
- Fixed all oxc errors in fluePersistence.ts and agents/src/db.ts
- Fixed all formatting across changed files
2026-07-28 02:53:05 +05:30
0e32c35515 Slice 4 hardening: bounded resolver, terminal states, reconciliation (#21)
Fixes review findings before Slice 5. Resolver: resolveOutcome + WORK_STATUS_FOR_OUTCOME + lifecycle fixes. Execution: bounded finishAttempt retry, terminal Work status preservation, slice validation, bounded reconciliation with 30s cron. Planning: revision guards, durable submitQuestion, design-approval invalidation. Primitives 69 (+4), backend 22 (+10) tests; root typecheck/build/Ultracite pass.
2026-07-27 18:39:09 +00:00
-Puter
005b26fa32 Slices 2-4: Work becomes executable
Domain primitives: versioned WorkDefinition/DesignPacket with risk, questions,
and approval gates; lifecycle transition table with invalidation rules;
Resolver (Run/Attempt/outcomes/CodingKitV0); provider-neutral HarnessRuntime
with normalized events and a deterministic FakeHarnessLive that always reaches
a terminal classification and never claims implementation.

Convex durable model: workDefinitions, workQuestions, workApprovals,
designPackets, workSlices, workRuns, workAttempts, workAttemptEvents tables;
broadened works.status union; generalized workEvents with optional signalId,
referenceId, and payloadJson. Authenticated commands for definition request/
save/revise/approve, question answer/withdraw, design save/revise/approve, and
simulated execution start/cancel/retry with leased attempts, checkpointed
events, and expired-lease reconciliation.

Private work-planner FLUE agent with proposal-only tools (definition, design,
question). Convex validates and stores every proposal; FLUE never approves or
advances Work.

Expanded Work card with Outcome, Design, and Build sections wired to the new
mutations. Slice 1 conversation and provenance preserved.
2026-07-27 22:52:14 +05:30
cb7484912c Convex-only Slice 1: clients talk to Convex, Flue is a private worker (#20) 2026-07-27 16:03:36 +00:00
-Puter
cc47007fa9 Slice 1 polish: archive dormant code, merge work-os into primitives, add futures
- Archive dormant apps (daemon, desktop, native, tui) and superseded
  packages/server into repos/ for reference
- Archive 21 dead web components (chat page shell, work-os cluster, strays)
  into repos/web/; keep reused message-rendering primitives in components/chat
- Merge @code/work-os into @code/primitives; work.ts absorbed via ./work
  subpath and barrel export; update all four importers
- Add docs/futures.md tracking audio/video (blocked at Flue + provider),
  web layout cleanup, and message rendering quality
- Repoint dev:zopu script to @code/agents (the live Flue server)
- Note repos/ reference-code convention in AGENTS.md
2026-07-27 16:34:17 +05:30
-Puter
d8383a788e feat: Slice 1 polish - MiMo V2.5 model, visible reasoning, image attachments, mobile keyboard fix
- Switch conversation agent to xiaomi/mimo-v2.5 (multimodal: text + image)
- Render native reasoning parts as live 'Thinking trace' (streaming open,
  collapsed after completion); inline <think> extraction for streaming models
- Image attachments: picker (up to 4, 10MB each), base64 to Flue
  AgentPromptImage, authenticated blob-URL replay for historical images
- Mobile keyboard viewport fix: visual-viewport hook, fixed shell,
  interactive-widget=resizes-content, header pinned, composer follows keyboard
- Conversation to Signal to proposed Work: Convex persistence, Effect
  validation in @code/work-os, Work cards with exact source provenance
- Streamdown markdown + Mermaid chart rendering in chat messages
- Flue tool turns hidden, reasoning-containing turns remain visible
- Frontend regression tests: keyboard viewport, responsive shell,
  attachment overflow, authenticated images, reasoning traces, transforms
- .env.example updated to xiaomi/mimo-v2.5 config
2026-07-27 12:22:54 +05:30
sai karthik
48200a11df Integrate mobile chat workspace and OpenRouter agent flow 2026-07-25 17:49:11 +05:30
a17aa5c283 Zopu dev bootstrap: git runtimes, Codex agent-os, dev agent
Merge t3code/explore-primitives-package onto master.
2026-07-24 21:50:45 +00:00
-Puter
e744ac4687 Add Zopu dev bootstrap: git runtimes, Codex agent-os, dev agent
A vertical slice to bootstrap the product loop on the canonical zopu-code repo.

Primitives (packages/primitives, all tested + lint/type clean):
- GitRemoteRuntime: Gitea REST client (createIssue, createBranch,
  createPullRequest, listIssues, getIssue) as an Effect context service with
  a fetch-backed transport. Live-verified against puter/zopu-code.
- GitLocalRuntime: clone, addWorktree, commit, push, currentBranch,
  setRemoteUrl over a pluggable Shell (host subprocess now, AgentOS VM exec
  later). Tested against real temp git repos.
- agent-os: Codex support via @agentos-software/codex-cli — codexSoftware
  bundle (codex+git), makeCodexAgentOsConfig(), codexSessionEnv() for the
  OpenAI base URL/key.

Env:
- GITEA_URL/GITEA_TOKEN wired into convex.ts and convex.config.ts.
- .env.example documents the self-hosted git section.

Agents (packages/agents):
- zopu-dev: development agent that creates issues on the canonical repo and
  starts autonomous work runs. git-remote tools (create/list/branch/PR) wired
  to GitRemoteRuntime; start_workflow tool enqueues a work run.
- flue run zopu-dev verified live (lists/creates issues on real Gitea).

Backend (packages/backend):
- workflows.startIssueWork mutation: fetches a Gitea issue server-side and
  admits a queued work run. The Codex VM spawn body is the next step.
2026-07-25 03:18:23 +05:30
-Puter
19f771ea71 fix(backend): explicit types on linked-signals toSorted comparator
Resolves implicit-any type errors blocking the Convex dev server from
starting on master after the dogfood merge.
2026-07-25 02:40:48 +05:30
-Puter
d645d3e08b test(signals): linked-signals query coverage and deterministic ordering
Add Convex backend tests for listLinkedSignalsForProject covering:
- Per-issue grouping with correct source counts
- Project membership/authz (denies non-member access)
- Cross-project signal suppression (project1 cannot see project2 signals)
- Multi-source signal source-count accuracy
- Empty project returns empty record
- Issues without linked signals are omitted from result

Make linked signals deterministically ordered newest-first within
each issue group via toSorted(createdAt descending).
2026-07-24 21:36:54 +05:30
-Puter
fd207eb067 feat(web): real linked Signal projection from signalIssueAttachments
Replace the deliberate signalCount of 0 with authenticated linked-Signal
data from the Lane A signalIssueAttachments relation.

- Add listLinkedSignalsForProject query (user-authenticated via
  requireProjectMember) returning issue-grouped LinkedSignalView data
  using the existing by_issue index. One query serves both card counts
  and expanded detail.
- Update work-unit-projection builders to accept linkedSignals param;
  LinkedSignal type with signalId, title, summary, sourceCount, createdAt.
- Feed real attachment data into collapsed card signalCount and expanded
  detail linked-signal list with provenance (source count, relative time).
- Add signal.attached event handler to activity timeline projection.
- 32 tests including 4 linked-signal projection tests, 1 signal.attached
  activity mapping test, and cross-issue signal isolation test proving
  issue A cannot inherit issue B's linked signals.
2026-07-24 21:21:31 +05:30
-Puter
03fc32bd6d feat(signals): project-scoped Zopu routing loop with secure tools
Add the complete project-scoped Zopu chat, Signal extraction, and
work-routing loop:

Backend (signalRouting.ts):
- Agent-token-gated functions for the full routing cycle: list evidence,
  create signal, list signals, list active issues, attach signal to
  issue, create issue from signal, begin issue, get project context,
  list projects
- attachSignalToIssue requires signal.projectId to exist and equal
  issue.projectId (org equality alone is insufficient)
- createIssueFromSignal is idempotent: queries existing attachments
  before creating, returns created/reused flag
- Duplicate attach retries return existing relation without emitting a
  duplicate event
- All functions deny-by-default with agent token validation

Schema:
- Add signalIssueAttachments table with indexes by signal, issue, and
  the composite (signalId, issueId) for idempotent lookups

Agent tools (tools/signals.ts):
- Nine Flue tool definitions bound to the organization-scoped agent
  instance ID, calling the agent-gated Convex functions
- Organization ID never accepted as free input; always from the bound
  instance

Zopu agent (zopu.ts):
- Comprehensive routing-loop instructions: assess actionability, identify
  project, create signal only when actionable, route via attach or create,
  explain outcome, optionally begin
- Wiring of routing tools into the agent definition

Tests (signalRouting.test.ts):
- Authentication: invalid token rejected on every function
- Project scoping: evidence, signals, issues scoped correctly
- Idempotency: duplicate attach, duplicate create-from-signal, duplicate
  signal creation
- Attach vs create: both paths verified
- Cross-project rejection: signal and issue must be in same project
- Org-scoped signal attach rejected (no projectId)
- Provenance: exact raw text preserved through routing loop
- Begin issue: transition and auth verification
2026-07-24 20:48:18 +05:30
-Puter
1324316fee fix(signals): source order follows agent selection, not chronological timestamps
Remove the OutOfOrderSource constraint from composeSignal. The agent's
selection order is authoritative for source ordinals; timestamps remain
as per-source provenance metadata. This resolves the contract conflict
where reversed message selections (valid agent compositions) were
rejected by the primitive.

Each source still retains its original createdAt, so chronological
provenance is preserved exactly. The sourceKey includes ordered message
IDs, so different orderings produce distinct signals with deterministic
idempotency.

Coverage added:
- Primitive: non-chronological order accepted, timestamps preserved
- Backend: reversed selection preserves ordinals and exact raw text
2026-07-24 20:32:48 +05:30
-Puter
fb438ba9a7 feat: wire mobile workspace into project loop 2026-07-24 03:17:59 +05:30
-Puter
9d54470774 merge mobile workspace UI into integration 2026-07-24 03:00:08 +05:30
sai karthik
a6bf07829b feat(backend): import public GitHub repositories 2026-07-24 02:57:07 +05:30
sai karthik
45e9fb1b77 fix(backend): avoid dynamic imports in project handlers 2026-07-24 02:35:45 +05:30
-Puter
43e7c9050a Merge branch 'puter/issue-5-gitea-lifecycle' into puter/issue-14-integration
# Conflicts:
#	bun.lock
#	packages/agents/package.json
#	packages/agents/src/agents/project-manager.ts
#	packages/backend/convex/agentWorkspace.ts
2026-07-24 02:31:21 +05:30
-Puter
6be2b3a67c Merge branch 'puter/issue-7-gitea-checkout' into puter/issue-14-integration
# Conflicts:
#	bun.lock
#	packages/agents/package.json
#	packages/primitives/package.json
#	packages/primitives/src/index.ts
2026-07-24 02:27:13 +05:30
-Puter
7caad057db feat: prepare issue workspaces from connected repositories 2026-07-24 02:19:35 +05:30
-Puter
a17d53cb41 feat: add post-run Gitea lifecycle (#5) 2026-07-24 02:05:30 +05:30
-Puter
38c73847e0 feat: dispatch authenticated project issue requests 2026-07-24 02:00:02 +05:30
sai karthik
b49ca236cf feat(web): connect mobile workspace to live data 2026-07-24 00:52:19 +05:30
-Puter
7365322197 fix: lint cleanup, remove tests for later rewrite, ES compat
- Fix all Ultracite lint errors on changed source files (0 remaining)
- Remove project.test.ts and use-personal-organization.test.ts (to be
  rewritten when implementation stabilizes)
- Replace .at(-1) with index access for backend tsconfig ES target compat
- Rename generator functions to avoid no-shadow conflicts
- Refactor nested ternaries into helper functions
- Fix unused imports
2026-07-23 18:48:26 +05:30
-Puter
e44759d7fe feat: generic project UI, branding fix, context/artifact separation
Web:
- Replace GitHub-specific import with generic public Git URL import
- Update project workspace page to use ProjectView shape (name, sources)
- Migrate use-project-workspace hook to importPublicGit action
- Fix status key needsInput → needs-input

Branding:
- Correct Zopo/zopo → Zopu/zopu in docs/PRODUCT.md, docs/DESIGN.md, docs/TECH.md

Artifacts:
- Cut to 8 operational artifacts (removed project/business/design.md)
- Update artifact seeds with generic context scaffolding
2026-07-23 18:31:48 +05:30
-Puter
224e98d0bc feat: add Convex project backend with generic storage and org-scoped authz
Schema:
- Cut projects table to {organizationId, name, description, createdAt, updatedAt}
- Add projectSources table with git source metadata and normalized URL index
- Add projectContextDocuments table with six canonical kinds, origin, revision
- Add by_organizationId index for project enumeration
- Remove all GitHub-specific fields (ownerId, provider, repoOwner, etc.)

Backend:
- Add requireCurrentOrganization and requireProjectMember authz helpers
- Migrate signals.ts authorizeProject to organizationId invariant check
- Update artifactModel: 8 operational artifacts (removed project/business/design.md)
- Add projectStore.ts with query/mutation/action store adapters
- Rewrite projects.ts to thin generic application calls
- Update projectIssues/projectArtifacts to use requireProjectMember
- Update projectEvents.test.ts and signals.test.ts for new project creation

All 33 backend tests pass.
2026-07-23 18:16:41 +05:30
-Puter
477e54240d feat: consolidate web auth and add Effect v4 Project primitives
Auth:
- Add useWebAuth hook as the single web-facing auth interface with four
  states (loading/unauthenticated/authenticated/inconsistent)
- Normalize getCurrentUser to return {id: tokenIdentifier, name, email}
- Rename requireOwnerId to requireAuthUserId across all backend callers
- Set expectAuth:true on ConvexReactClient singleton
- Migrate _app, _auth, user-menu, use-personal-organization to useWebAuth
- Remove unused @code/auth/server export (zero callers confirmed)

Primitives:
- Add packages/primitives/src/project.ts with Effect v4 Project domain:
  URL normalization, six canonical context kinds, strict remote decoding,
  context write decisioning with revision tracking, and no-op detection
- Define PublicGit and ProjectStore replaceable ports
- Define ProjectApplication service orchestrating domain+ports with
  deterministic error mapping
- Add comprehensive test suite (28 tests) with in-memory store and fake
  PublicGit covering normalization, seeds, idempotency, tenant isolation,
  last-write-wins, and typed error mapping
2026-07-23 18:04:02 +05:30
-Puter
f35b381477 style(backend): format signal persistence 2026-07-23 17:19:38 +05:30
-Puter
d3381f978f feat(agents): add signal tools to zopu agent 2026-07-23 17:17:19 +05:30
-Puter
6d86c8e538 feat(schema): add signals and signal sources tables 2026-07-23 17:09:01 +05:30
-Puter
5d5139dc95 feat(chat): scope agent to current organization 2026-07-23 16:31:52 +05:30
-Puter
535e9dde62 refactor(backend): rename projectSignals to projectEvents 2026-07-23 16:04:00 +05:30
-Puter
c6f3cd330a feat(authz): add organization member authorization check 2026-07-23 15:42:51 +05:30
-Puter
a405fcf785 Fix sai changes integration blockers 2026-07-23 01:27:03 +05:30
sai karthik
b0aef54249 Apply the bracketed Convex API module references required by the kebab-case module rename 2026-07-23 00:50:08 +05:30
sai karthik
74a209a807 intial files 2026-07-23 00:19:53 +05:30
-Puter
12537e1576 Add Flue persistence backend on Convex
- Define the schema v4 Flue tables (submissions, attempt markers,
  conversation streams/batches, event streams/entries, runs, attachments,
  meta) in schema.ts with the indexes the adapter relies on.
- Implement fluePersistence.ts: token-gated queries/mutations covering
  submission lifecycle, leasing, settlement, conversation/event streams,
  runs, and attachments.
2026-07-19 17:29:30 +05:30
-Puter
e91ca4e6f0 Declare typed Convex env and route auth through @code/env/convex
- Register SITE_URL, NATIVE_APP_URL, CONVEX_SITE_URL, FLUE_DB_TOKEN in
  convex.config.ts so the generated server.js exposes a typed env object.
- Rewrite auth.ts to consume @code/env/convex and tighten the
  getCurrentUser handler.
- Refresh the backend README to describe the control-plane role and
  generated-file policy.
2026-07-19 17:29:21 +05:30
-Puter
ec84c52155 Add AgentOS daemon control plane and maintenance tooling 2026-07-19 06:29:51 +05:30
-Puter
dd1071cc10 Add agents package with Flue 2026-07-19 03:24:40 +05:30
-Puter
8033a8edb0 initial commit 2026-07-19 02:46:47 +05:30