@a5c-ai/krate 5.0.1-staging.f672fe79b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Dockerfile +29 -0
- package/README.md +183 -0
- package/bin/krate-demo.mjs +23 -0
- package/bin/krate-server.mjs +14 -0
- package/dist/krate-controller-ui.json +2407 -0
- package/dist/krate-lifecycle.json +201 -0
- package/dist/krate-runtime-snapshot.json +2955 -0
- package/dist/krate-summary.json +687 -0
- package/docs/README.md +61 -0
- package/docs/agents/README.md +83 -0
- package/docs/agents/acceptance-test-matrix.md +193 -0
- package/docs/agents/agent-mux-adapter-contract.md +167 -0
- package/docs/agents/agent-mux-source-map.md +310 -0
- package/docs/agents/agent-run-memory-import-spec.md +256 -0
- package/docs/agents/agent-stack-management-spec.md +421 -0
- package/docs/agents/api-contract-spec.md +309 -0
- package/docs/agents/artifacts-writeback-spec.md +145 -0
- package/docs/agents/chart-packaging-spec.md +128 -0
- package/docs/agents/ci-orchestration-spec.md +140 -0
- package/docs/agents/context-assembly-spec.md +219 -0
- package/docs/agents/controller-reconciliation-spec.md +255 -0
- package/docs/agents/crd-schema-spec.md +315 -0
- package/docs/agents/decision-log-open-questions.md +169 -0
- package/docs/agents/developer-implementation-checklist.md +329 -0
- package/docs/agents/dispatching-design.md +262 -0
- package/docs/agents/glossary.md +66 -0
- package/docs/agents/implementation-blueprint.md +324 -0
- package/docs/agents/implementation-rollout-slices.md +251 -0
- package/docs/agents/memory-context-integration-spec.md +194 -0
- package/docs/agents/memory-ontology-schema-spec.md +253 -0
- package/docs/agents/memory-operations-runbook.md +121 -0
- package/docs/agents/mvp-vertical-slice-spec.md +146 -0
- package/docs/agents/observability-audit-spec.md +265 -0
- package/docs/agents/operator-runbook.md +174 -0
- package/docs/agents/org-memory-api-payload-examples.md +333 -0
- package/docs/agents/org-memory-controller-sequence-spec.md +181 -0
- package/docs/agents/org-memory-e2e-fixture-plan.md +161 -0
- package/docs/agents/org-memory-ui-implementation-map.md +114 -0
- package/docs/agents/org-memory-vertical-slice-spec.md +168 -0
- package/docs/agents/org-resource-model-delta-spec.md +111 -0
- package/docs/agents/org-route-resource-model-spec.md +183 -0
- package/docs/agents/org-scoping-namespace-spec.md +114 -0
- package/docs/agents/rbac-secrets-management-spec.md +406 -0
- package/docs/agents/repository-page-integration-spec.md +255 -0
- package/docs/agents/resource-contract-examples.md +808 -0
- package/docs/agents/resource-relationship-map.md +190 -0
- package/docs/agents/security-threat-model.md +188 -0
- package/docs/agents/shared-memory-company-brain-spec.md +358 -0
- package/docs/agents/storage-migration-spec.md +168 -0
- package/docs/agents/subagent-orchestration-spec.md +152 -0
- package/docs/agents/system-overview.md +88 -0
- package/docs/agents/tools-mcp-skills-spec.md +189 -0
- package/docs/agents/traceability-matrix.md +79 -0
- package/docs/agents/ui-flow-spec.md +211 -0
- package/docs/agents/ui-ux-system-spec.md +426 -0
- package/docs/agents/workspace-lifecycle-spec.md +166 -0
- package/docs/architecture-spec.md +78 -0
- package/docs/components/control-plane.md +78 -0
- package/docs/components/data-plane.md +69 -0
- package/docs/components/hooks-events.md +67 -0
- package/docs/components/identity-rbac-policy.md +73 -0
- package/docs/components/kubevela-oam.md +70 -0
- package/docs/components/operations-publishing.md +81 -0
- package/docs/components/runners-ci.md +66 -0
- package/docs/components/web-ui.md +94 -0
- package/docs/external/README.md +47 -0
- package/docs/external/bidirectional-sync-design.md +134 -0
- package/docs/external/cicd-interface.md +64 -0
- package/docs/external/external-backend-controllers.md +170 -0
- package/docs/external/external-backend-crds.md +234 -0
- package/docs/external/external-backend-ui-spec.md +151 -0
- package/docs/external/external-backend-ux-flows.md +115 -0
- package/docs/external/external-object-mapping.md +125 -0
- package/docs/external/git-forge-interface.md +68 -0
- package/docs/external/github-integration-design.md +151 -0
- package/docs/external/issue-tracking-interface.md +66 -0
- package/docs/external/provider-capability-manifests.md +204 -0
- package/docs/external/provider-catalog.md +139 -0
- package/docs/external/provider-rollout-testing.md +78 -0
- package/docs/external/research-results.md +48 -0
- package/docs/external/security-auth-permissions.md +81 -0
- package/docs/external/sync-state-machines.md +108 -0
- package/docs/external/unified-external-backend-model.md +107 -0
- package/docs/external/user-facing-changes.md +67 -0
- package/docs/gaps.md +161 -0
- package/docs/install.md +94 -0
- package/docs/krate-design.md +334 -0
- package/docs/local-minikube.md +55 -0
- package/docs/ontology/README.md +32 -0
- package/docs/ontology/bounded-contexts.md +29 -0
- package/docs/ontology/events-and-hooks.md +32 -0
- package/docs/ontology/oam-kubevela.md +32 -0
- package/docs/ontology/operations-and-release.md +25 -0
- package/docs/ontology/personas-and-actors.md +32 -0
- package/docs/ontology/policies-and-invariants.md +33 -0
- package/docs/ontology/problem-space.md +30 -0
- package/docs/ontology/resource-contracts.md +40 -0
- package/docs/ontology/resource-taxonomy.md +42 -0
- package/docs/ontology/runners-and-ci.md +29 -0
- package/docs/ontology/solution-space.md +24 -0
- package/docs/ontology/storage-and-data-boundaries.md +29 -0
- package/docs/ontology/validation-matrix.md +24 -0
- package/docs/ontology/web-ui-excellent-flows.md +32 -0
- package/docs/ontology/workflows.md +39 -0
- package/docs/ontology/world.md +35 -0
- package/docs/product-requirements.md +62 -0
- package/docs/roadmap-mvp.md +87 -0
- package/docs/system-requirements.md +90 -0
- package/docs/tests/README.md +53 -0
- package/docs/tests/agent-qa-plan.md +63 -0
- package/docs/tests/browser-ui-tests.md +62 -0
- package/docs/tests/ci-quality-gates.md +48 -0
- package/docs/tests/coverage-model.md +64 -0
- package/docs/tests/e2e-scenario-tests.md +53 -0
- package/docs/tests/fixtures-test-data.md +63 -0
- package/docs/tests/observability-reliability-tests.md +54 -0
- package/docs/tests/product-test-matrix.md +145 -0
- package/docs/tests/qa-adoption-roadmap.md +130 -0
- package/docs/tests/qa-automation-plan.md +101 -0
- package/docs/tests/security-compliance-tests.md +57 -0
- package/docs/tests/test-framework-tools.md +88 -0
- package/docs/tests/test-suite-layout.md +121 -0
- package/docs/tests/unit-integration-tests.md +48 -0
- package/docs/todo-kyverno +714 -0
- package/docs/user-stories.md +78 -0
- package/examples/minikube-demo.yaml +190 -0
- package/examples/oam-application.yaml +23 -0
- package/examples/policy-kyverno-pr-title.yaml +18 -0
- package/package.json +63 -0
- package/scripts/build.mjs +29 -0
- package/scripts/setup-minikube.mjs +65 -0
- package/scripts/smoke.mjs +37 -0
- package/scripts/validate-doc-coverage.mjs +152 -0
- package/scripts/validate-package.mjs +93 -0
- package/scripts/validate-ui.mjs +207 -0
- package/src/agent-approval-controller.js +123 -0
- package/src/agent-context-bundles.js +242 -0
- package/src/agent-dispatch-controller.js +86 -0
- package/src/agent-mux-client.js +280 -0
- package/src/agent-permission-review.js +162 -0
- package/src/agent-stack-controller.js +296 -0
- package/src/agent-trigger-controller.js +108 -0
- package/src/api-controller.js +206 -0
- package/src/argocd-gitops.js +43 -0
- package/src/auth.js +265 -0
- package/src/component-catalog.js +41 -0
- package/src/control-plane.js +136 -0
- package/src/controller-client.js +38 -0
- package/src/controller-ui.js +538 -0
- package/src/data-plane.js +178 -0
- package/src/gitea-backend.js +95 -0
- package/src/handoff.js +98 -0
- package/src/hooks-events.js +63 -0
- package/src/http-server.js +151 -0
- package/src/identity-policy.js +86 -0
- package/src/index.js +30 -0
- package/src/kubernetes-controller.js +812 -0
- package/src/kubernetes-resource-gateway.js +48 -0
- package/src/operations.js +112 -0
- package/src/resource-model.js +203 -0
- package/src/runners-ci.js +48 -0
- package/src/runtime.js +196 -0
- package/src/web-ui.js +40 -0
- package/tests/agent-approval-controller.test.js +173 -0
- package/tests/agent-context-bundles.test.js +278 -0
- package/tests/agent-dispatch-controller.test.js +176 -0
- package/tests/agent-mux-client.test.js +204 -0
- package/tests/agent-permission-review.test.js +209 -0
- package/tests/agent-resources.test.js +212 -0
- package/tests/agent-stack-controller.test.js +221 -0
- package/tests/agent-trigger-controller.test.js +211 -0
- package/tests/deployment.test.js +395 -0
- package/tests/e2e/lifecycle.test.js +117 -0
- package/tests/krate.test.js +727 -0
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
# Agent UI/UX system spec
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Agent UX in Krate must be more than screens. Every visible affordance should map to a resource, API contract, controller behavior, policy check, and event stream. This document defines how the Agent Mux-inspired UI primitives affect the app, agent stack model, custom resources, aggregated resources, and controllers.
|
|
6
|
+
|
|
7
|
+
## Design principle
|
|
8
|
+
|
|
9
|
+
The UI is a projection of the orchestration graph:
|
|
10
|
+
|
|
11
|
+
- If the user can click it, there must be a resource/action behind it.
|
|
12
|
+
- If an agent can do it, there must be a policy and audit path for it.
|
|
13
|
+
- If a run appears in the UI, it must be watchable and link back to source event, workspace, session, stack, artifacts, and approvals.
|
|
14
|
+
- If a setting changes launch behavior, it belongs in an `AgentStack`, tool/MCP/skill/subagent resource, trigger rule, or policy resource, not only in local UI state.
|
|
15
|
+
|
|
16
|
+
## Navigation model
|
|
17
|
+
|
|
18
|
+
### Global navigation
|
|
19
|
+
|
|
20
|
+
Add an `Agents` top-level section, but keep agent state visible in existing repository workflows.
|
|
21
|
+
|
|
22
|
+
Global pages:
|
|
23
|
+
|
|
24
|
+
- `/agents`: overview of stacks, active dispatches, trigger health, pending approvals, and workspace/session activity.
|
|
25
|
+
- `/agents/stacks`: stack registry for base agents, models, prompts, tools, MCP servers, skills, subagents, runner policy, and write-back policy.
|
|
26
|
+
- `/agents/runs`: cross-repository `AgentDispatchRun` list, shaped like pipeline runs.
|
|
27
|
+
- `/agents/rules`: trigger rules, deliveries, dry-runs, lifecycle, and execution summaries.
|
|
28
|
+
- `/agents/tools`: native tool profiles, command allow/deny policy, filesystem/network policy.
|
|
29
|
+
- `/agents/mcp`: MCP server registry, health, discovered tools, secret refs, and allowed stacks.
|
|
30
|
+
- `/agents/skills`: skill/runbook registry and validation state.
|
|
31
|
+
- `/agents/workspaces`: agent-owned or agent-linked workspace inventory.
|
|
32
|
+
- `/agents/approvals`: cross-repository approvals and human gates.
|
|
33
|
+
- `/agents/identities`: users, teams, agent ServiceAccounts, runner ServiceAccounts, and native Kubernetes RBAC projection.
|
|
34
|
+
- `/agents/secrets`: Secret and ConfigMap inventory, grants, consumers, rotation state, and missing-permission warnings.
|
|
35
|
+
- `/agents/permissions`: role templates, RoleBindings, ClusterRoleBindings, grant graph, drift, and escalation warnings.
|
|
36
|
+
|
|
37
|
+
Repository pages must embed agent affordances inline:
|
|
38
|
+
|
|
39
|
+
- `/orgs/[org]/repositories/[repo]/code`: manual dispatch from paths, workspace links, and active sessions.
|
|
40
|
+
- `/orgs/[org]/repositories/[repo]/pull-requests`: check diagnosis, repair, review agents, patch artifacts, and PR write-back approvals.
|
|
41
|
+
- `/orgs/[org]/repositories/[repo]/issues`: issue-to-agent workspace/session links, context labels, board state, and dispatch readiness.
|
|
42
|
+
- `/orgs/[org]/repositories/[repo]/runs`: agent dispatch rows beside pipeline/job rows.
|
|
43
|
+
- `/orgs/[org]/repositories/[repo]/hooks`: incoming webhook triggers and delivery replay.
|
|
44
|
+
- `/orgs/[org]/repositories/[repo]/settings/agents`: repository-scoped stack permissions, trigger rules, MCP/skill allow-lists, runner policy, ServiceAccount selection, Secret grants, ConfigMap grants, and native role bindings.
|
|
45
|
+
|
|
46
|
+
## Agent Mux route-to-Krate route mapping
|
|
47
|
+
|
|
48
|
+
Krate should keep GitHub-like repository navigation as the primary frame and use Agent Mux patterns inside that frame. Agent Mux standalone routes become either global operations pages or embedded repository tabs.
|
|
49
|
+
|
|
50
|
+
| Agent Mux route | Krate route/surface | Backing resources | Controller/watch impact |
|
|
51
|
+
| --- | --- | --- | --- |
|
|
52
|
+
| `/agents` | `/agents` and `/agents/stacks` | `AgentStack`, adapter capability projections | Stack controller resolves capabilities, readiness, and warnings. |
|
|
53
|
+
| `/sessions`, `/sessions/new` | `/agents/sessions`, dispatch composer in repo/PR/issue pages | `AgentSession`, `AgentDispatchRun` draft | Dispatch controller creates runs; Agent Mux adapter opens or resumes sessions. |
|
|
54
|
+
| `/sessions/pending/:runId` | `/agents/runs/:runId?handoff=pending` | `AgentDispatchAttempt.status.agentMuxRunId` | Attempt waits for Agent Mux session binding and emits `SessionBindingPending`. |
|
|
55
|
+
| `/dispatches`, `/dispatches/:runId` | `/agents/runs`, `/orgs/[org]/repositories/[repo]/agents/[run]`, `/orgs/[org]/repositories/[repo]/runs/[run]` | `AgentDispatchRun`, `AgentDispatchAttempt`, `AgentApproval` | Dispatch controller reconciles CI-like run status, event cursor, approvals, and artifacts. |
|
|
56
|
+
| `/projects`, `/projects/:projectId/board`, `/projects/:projectId/list` | `/orgs/[org]/repositories/[repo]/issues`, `/orgs/[org]/repositories/[repo]/workspaces`, org project board if added | `WorkItem`, `WorkItemWorkspaceLink`, `WorkItemSessionLink` | Work graph controller maintains board/list projections and association edges. |
|
|
57
|
+
| `/projects/:projectId/issues/new`, `/issues/:issueId` | `/orgs/[org]/repositories/[repo]/issues/[issue]` and issue create drawer | `Issue`, `WorkItem`, `AgentContextLabel` | Issue controller exposes agent dispatch readiness and context labels. |
|
|
58
|
+
| `/projects/:projectId/workspaces/new`, `/projects/:projectId/issues/:issueId/workspace/new`, `/workspaces/new` | `/orgs/[org]/repositories/[repo]/workspaces/new` and issue workspace action | `AgentWorkspace`, `AgentWorkspacePolicy`, `WorkItemWorkspaceLink` | Workspace controller provisions git worktrees, records ownership, and links sessions/runs. |
|
|
59
|
+
| `/workspaces` | `/agents/workspaces`, `/orgs/[org]/repositories/[repo]/workspaces` | `AgentWorkspace`, runtime summaries | Workspace controller watches git/runtime state and lifecycle actions. |
|
|
60
|
+
| `/inbox` | `/agents/approvals` and repository inbox | `AgentApproval`, webhook delivery, review queue | Approval controller groups human gates, rejected writes, and action-required work. |
|
|
61
|
+
| `/automations` | `/agents/rules` and `/orgs/[org]/repositories/[repo]/settings/agents/triggers` | `AgentTriggerRule`, `WebhookDelivery`, rule execution records | Trigger controller handles lifecycle, dry-run, dedupe, coalescing, and replay. |
|
|
62
|
+
| `/settings` | `/agents/settings`, `/orgs/[org]/repositories/[repo]/settings/agents` | stack permissions, MCP allow-lists, runner policy | Policy controllers produce disabled states and admission errors. |
|
|
63
|
+
|
|
64
|
+
### GitHub-like repository hierarchy
|
|
65
|
+
|
|
66
|
+
Repository navigation should be consistent with GitHub mental models:
|
|
67
|
+
|
|
68
|
+
- `Code` owns manual dispatch from a path, file selection, branch/worktree status, and active workspace/session chips.
|
|
69
|
+
- `Issues` owns work item boards, context labels, linked workspaces, linked sessions, and issue-triggered dispatches.
|
|
70
|
+
- `Pull Requests` owns review agents, diff artifacts, check diagnosis, patch proposals, and write-back approval gates.
|
|
71
|
+
- `Actions` or `Runs` owns CI-like agent runs beside workflow/job rows, with identical status, duration, runner, and artifact affordances.
|
|
72
|
+
- `Settings > Agents` owns repository-scoped stacks, trigger rules, MCP/skill/tool allow-lists, runner placement, and secrets policy.
|
|
73
|
+
|
|
74
|
+
## Component primitive matrix
|
|
75
|
+
|
|
76
|
+
These Agent Mux primitives should be treated as product capabilities, not copied as isolated UI widgets.
|
|
77
|
+
|
|
78
|
+
| Agent Mux primitive | Krate capability | Backing resource/action | Required controller behavior |
|
|
79
|
+
| --- | --- | --- | --- |
|
|
80
|
+
| Command palette | Universal jump-to and quick actions for runs, sessions, workspaces, approvals, rules | `AgentActionSuggestion` aggregated from resources | Authorize every command server-side; palette only renders admitted actions. |
|
|
81
|
+
| Sidebar/topbar status pills | Live operational counters and connection health | watch summaries for runs/sessions/approvals/workspaces | Stream counters from controllers; show reconnect/stale states explicitly. |
|
|
82
|
+
| Project board/list | Issue-session-workspace management | `WorkItem`, `WorkItemWorkspaceLink`, `WorkItemSessionLink` | Maintain board state, WIP policy, child issues, and association graph. |
|
|
83
|
+
| Issue detail | Dispatch-ready work item hub | issue, context labels, linked sessions/workspaces/runs | Assemble context bundle preview and expose safe dispatch/write-back actions. |
|
|
84
|
+
| Dispatch queue | CI-like operational run list | `AgentDispatchRun`, `AgentDispatchAttempt`, `AgentApproval` | Reconcile Agent Mux event streams, approvals, retries, cancellation, and artifacts. |
|
|
85
|
+
| Dispatch detail | Run timeline plus chat handoff | dispatch attempt, Agent Mux run/session IDs | Bind pending session, redirect legacy run paths, and preserve run breadcrumbs. |
|
|
86
|
+
| Session conversation surface | Durable chat for an agent run | `AgentSession`, `AgentDispatchAttempt` | Proxy transcript, continuation, tool approvals, and reconnect events. |
|
|
87
|
+
| Session observability panel | Task/subagent/tool/runtime narrative | attempt event stream, subagent events, artifacts | Normalize events into timeline, cost, artifact shortcuts, and source links. |
|
|
88
|
+
| Workspace provisioning | Guided git worktree creation from issue/project/host | `AgentWorkspace`, `AgentWorkspacePolicy` | Enforce policy, create workspace, set ownership, and link to work item/session. |
|
|
89
|
+
| Workspace detail/runtime | Runtime preview, branch, notes, rebase and cleanup | workspace lifecycle action requests | Keep git status, runtime URL, sessions, runs, notes, and recovery state current. |
|
|
90
|
+
| Automations page | Trigger rule management | `AgentTriggerRule`, delivery records, execution summaries | Validate sources, lifecycle, target stack, dedupe/concurrency, and dry-runs. |
|
|
91
|
+
| Review panel | Agent-produced review artifact and decision workflow | `AgentReviewArtifact`, `AgentApproval`, linked PR | Gate comments/submissions, persist reviewer decisions, and apply write-back safely. |
|
|
92
|
+
| Execution context panel | Prompt/context transparency | `AgentContextBundle`, `AgentContextLabel`, attachments | Display provenance, redactions, prompt hash, and label-injected prompt fragments. |
|
|
93
|
+
| Breakpoint/approval panels | Human gates during execution | `AgentApproval` | Block continuation until decision; audit actor, reason, and policy source. |
|
|
94
|
+
|
|
95
|
+
## Screen state requirements from Agent Mux research
|
|
96
|
+
|
|
97
|
+
Krate pages must preserve the operational states that make Agent Mux useful:
|
|
98
|
+
|
|
99
|
+
- `SessionBindingPending`: dispatch has a run ID but no durable chat session yet; show pending handoff and retry/recover controls.
|
|
100
|
+
- `LegacyRunRedirect`: old run links resolve to the canonical dispatch page without losing breadcrumbs.
|
|
101
|
+
- `StreamDisconnected` and `StreamReconnecting`: transcript/event timelines remain readable, mark stale data, and resume from cursor.
|
|
102
|
+
- `WorkspaceMissing`: workspace record exists but path is gone; allow recover, relink, archive, or cleanup according to policy.
|
|
103
|
+
- `WorkspaceRebaseNeeded` and `WorkspaceRebaseConflicts`: keep conflict files, auto-resolve attempt, editor link, and mark-resolved actions visible.
|
|
104
|
+
- `AutomationRejected`: trigger delivery matched but policy/admission rejected it; show rule, payload, actor, and rejection reason.
|
|
105
|
+
- `AutomationCoalesced`: trigger delivery deduped or concurrency-blocked; link to the existing run and coalescing key.
|
|
106
|
+
- `ReviewChangesRequested`: review artifact is not write-backable until agent/user follow-up resolves requested changes.
|
|
107
|
+
- `ApprovalBlocked`: run is waiting on a human decision for tool, network, secret, shell, write-back, rebase, or release action.
|
|
108
|
+
- `ContextLabelDrift`: context label changed after dispatch; preserve snapshot used by the run and warn before retry.
|
|
109
|
+
|
|
110
|
+
## UI primitives and system effects
|
|
111
|
+
|
|
112
|
+
| UI primitive | User sees | Backing resource/action | Controller effect |
|
|
113
|
+
| --- | --- | --- | --- |
|
|
114
|
+
| Stack builder | Form/YAML for base agent, model, prompt, tools, MCP, skills, subagents | `AgentStack`, `AgentToolProfile`, `AgentMcpServer`, `AgentSkill`, `AgentSubagent` | Validate adapter capabilities and policy; update stack status. |
|
|
115
|
+
| Trigger rule builder | Event source, matcher, dry-run preview, lifecycle controls | `AgentTriggerRule`, `WebhookDelivery`, sample event | Evaluate dry-run, persist rule, update execution summaries. |
|
|
116
|
+
| Dispatch composer | Prompt, context labels, files/logs/artifacts, selected stack | `AgentContextBundle`, `AgentDispatchRun` draft | Assemble/redact context, compute digest, require approval if needed. |
|
|
117
|
+
| CI-like agent run row | Status, queue, runner, source, duration, artifacts | `AgentDispatchRun`, `AgentDispatchAttempt` | Reconcile Agent Mux run/session state into Krate run status. |
|
|
118
|
+
| Chat/session panel | Transcript, continuation box, tool activity | Agent Mux session ID on `AgentDispatchAttempt` | Proxy/subscribe to Agent Mux events; submit continuation/cancel/resume. |
|
|
119
|
+
| Subagent tree | Child lanes with role, status, findings, artifacts | `AgentSubagent` snapshot plus attempt subevents | Record subagent start/complete/fail events and outputs. |
|
|
120
|
+
| Workspace shell | branch, git status, runtime preview, terminal/dev server, notes | `AgentWorkspace`, `WorkItemWorkspaceLink` | Inventory workspace, surface runtime state, run lifecycle actions. |
|
|
121
|
+
| Review artifact panel | Diff, comments, decision, execution targets | `AgentReviewArtifact` or `Review` extension | Persist artifact, gate write-back, link to PR/issue/workspace/session. |
|
|
122
|
+
| Approval inbox | Pending tool/write-back/rebase/secret/network approvals | `AgentApproval` | Block/release continuation or write-back; audit decision. |
|
|
123
|
+
| Context label chips | Prompt fragments and provenance | `AgentContextLabel` | Render context block, compute prompt hash, record label provenance. |
|
|
124
|
+
| MCP health card | Server status and discovered tools | `AgentMcpServer.status` | Probe MCP server and refresh discovered tool inventory. |
|
|
125
|
+
| ServiceAccount picker | Agent and runner runtime identities | `AgentServiceAccount`, native `ServiceAccount` | Sync/select identities and show token projection/readiness. |
|
|
126
|
+
| Role binding matrix | Users, teams, agents, runners, roles, and scopes | `AgentRoleBinding`, native RBAC | Sync RoleBindings and show denied/escalation/drift states. |
|
|
127
|
+
| Secret grant matrix | Secret keys, consumers, purposes, and grants | `AgentSecretGrant`, native `Secret` metadata | Validate access without exposing secret values. |
|
|
128
|
+
| Config grant matrix | ConfigMap keys, consumers, purposes, and grants | `AgentConfigGrant`, native `ConfigMap` metadata | Validate config access and warn on sensitive keys. |
|
|
129
|
+
| Capability requirements panel | Tool/skill/MCP/model secret and config needs | `AgentCapabilityRequirement` | Compare requirements with grants and block invalid stacks. |
|
|
130
|
+
|
|
131
|
+
## Custom resource split
|
|
132
|
+
|
|
133
|
+
Use CRDs for low-cardinality declarative configuration and aggregated resources for high-cardinality execution records.
|
|
134
|
+
|
|
135
|
+
### CRD-backed configuration
|
|
136
|
+
|
|
137
|
+
- `AgentStack`: reusable agent definition.
|
|
138
|
+
- `AgentSubagent`: reusable subagent definition.
|
|
139
|
+
- `AgentToolProfile`: tool/shell/filesystem/network policy.
|
|
140
|
+
- `AgentMcpServer`: MCP endpoint definition and allowed scopes.
|
|
141
|
+
- `AgentSkill`: skill/runbook source and compatibility policy.
|
|
142
|
+
- `AgentTriggerRule`: event-to-stack routing rule.
|
|
143
|
+
- `AgentContextLabel`: reviewed prompt fragment and attachments.
|
|
144
|
+
- `AgentWorkspacePolicy`: workspace provisioning, cleanup, rebase, retention, and trust policy.
|
|
145
|
+
- `AgentServiceAccount`: managed runtime identity for agents and runners.
|
|
146
|
+
- `AgentRoleBinding`: Krate-managed projection to native Kubernetes RBAC.
|
|
147
|
+
- `AgentSecretGrant`: Secret key access grant for users, teams, agents, tools, skills, MCP servers, and runners.
|
|
148
|
+
- `AgentConfigGrant`: ConfigMap key access grant for users, teams, agents, tools, skills, MCP servers, and runners.
|
|
149
|
+
|
|
150
|
+
These resources should support YAML transparency in the UI: view YAML, copy `kubectl apply`, save draft, or open a PR.
|
|
151
|
+
|
|
152
|
+
### Aggregated/high-cardinality resources
|
|
153
|
+
|
|
154
|
+
- `AgentDispatchRun`: logical dispatch visible like a pipeline run.
|
|
155
|
+
- `AgentDispatchAttempt`: concrete attempt/retry/resume/continuation.
|
|
156
|
+
- `AgentContextBundle`: materialized redacted context with digest and source refs.
|
|
157
|
+
- `AgentSession`: projection of Agent Mux session and transcript state.
|
|
158
|
+
- `AgentWorkspace`: inventory/projection of active/idle/archived/missing workspaces.
|
|
159
|
+
- `AgentApproval`: pending/completed human gates.
|
|
160
|
+
- `AgentReviewArtifact`: agent-produced diff/comment/decision artifact.
|
|
161
|
+
- `AgentTriggerExecution`: trigger rule execution summary with dedupe/rejection reason.
|
|
162
|
+
- `AgentToolEvent`: normalized tool/MCP/subagent event stream when retention policy requires queryable records.
|
|
163
|
+
|
|
164
|
+
These should be watchable, queryable, paginated, and backed by Postgres or another aggregated API storage path rather than etcd-only history.
|
|
165
|
+
|
|
166
|
+
## Controller responsibilities
|
|
167
|
+
|
|
168
|
+
### Agent stack controller
|
|
169
|
+
|
|
170
|
+
Watches `AgentStack`, `AgentSubagent`, `AgentToolProfile`, `AgentMcpServer`, and `AgentSkill`.
|
|
171
|
+
|
|
172
|
+
Responsibilities:
|
|
173
|
+
|
|
174
|
+
- resolve stack references;
|
|
175
|
+
- validate Agent Mux adapter capability compatibility;
|
|
176
|
+
- validate tool/MCP/skill/subagent policy;
|
|
177
|
+
- compute effective launch profile;
|
|
178
|
+
- update status with valid/warning/invalid and actionable reasons.
|
|
179
|
+
|
|
180
|
+
### Trigger controller
|
|
181
|
+
|
|
182
|
+
Watches `AgentTriggerRule`, repository events, CI events, webhook deliveries, comments, labels, pushes, tags, and schedules.
|
|
183
|
+
|
|
184
|
+
Responsibilities:
|
|
185
|
+
|
|
186
|
+
- evaluate matchers;
|
|
187
|
+
- dry-run sample events;
|
|
188
|
+
- dedupe and concurrency control;
|
|
189
|
+
- create/update work items when configured;
|
|
190
|
+
- materialize `AgentContextBundle`;
|
|
191
|
+
- create `AgentDispatchRun` and first `AgentDispatchAttempt`;
|
|
192
|
+
- update rule execution summaries.
|
|
193
|
+
|
|
194
|
+
### Dispatch controller
|
|
195
|
+
|
|
196
|
+
Watches `AgentDispatchRun` and `AgentDispatchAttempt`.
|
|
197
|
+
|
|
198
|
+
Responsibilities:
|
|
199
|
+
|
|
200
|
+
- place attempt on runner pool or external Agent Mux gateway;
|
|
201
|
+
- start Agent Mux run/session;
|
|
202
|
+
- persist Agent Mux IDs;
|
|
203
|
+
- stream status/events into Krate resources;
|
|
204
|
+
- handle cancel/retry/resume/fork/continue;
|
|
205
|
+
- collect artifacts and subagent outputs;
|
|
206
|
+
- transition phases and terminal states.
|
|
207
|
+
|
|
208
|
+
### Workspace controller
|
|
209
|
+
|
|
210
|
+
Watches work item/workspace/session links and workspace policies.
|
|
211
|
+
|
|
212
|
+
Responsibilities:
|
|
213
|
+
|
|
214
|
+
- provision/link workspaces;
|
|
215
|
+
- inventory git state and runtime surfaces;
|
|
216
|
+
- handle pin/archive/cleanup/recover/rebase/notes actions;
|
|
217
|
+
- attach workspace state to dispatch run and session views;
|
|
218
|
+
- enforce trust-tier workspace isolation.
|
|
219
|
+
|
|
220
|
+
### Approval/write-back controller
|
|
221
|
+
|
|
222
|
+
Watches `AgentApproval`, artifacts, and write-back requests.
|
|
223
|
+
|
|
224
|
+
Responsibilities:
|
|
225
|
+
|
|
226
|
+
- hold privileged actions until approved;
|
|
227
|
+
- apply approved PR comments, reviews, branch updates, workflow reruns, or issue updates;
|
|
228
|
+
- reject/expire blocked requests;
|
|
229
|
+
- record actor, approver, source event, stack snapshot, context digest, and artifact digest.
|
|
230
|
+
|
|
231
|
+
### RBAC and secret/config controller
|
|
232
|
+
|
|
233
|
+
Watches users, teams, ServiceAccounts, native RBAC resources, Secrets, ConfigMaps, agent stacks, tools, skills, MCP servers, and grant resources.
|
|
234
|
+
|
|
235
|
+
Responsibilities:
|
|
236
|
+
|
|
237
|
+
- sync Krate role/service-account intent into native Kubernetes RBAC resources;
|
|
238
|
+
- import external native RBAC as read-only projections when Krate does not own it;
|
|
239
|
+
- validate tool-secret, skill-secret, MCP-secret, model-secret, and ConfigMap requirements;
|
|
240
|
+
- show stack readiness warnings when selected ServiceAccount lacks required Secret, ConfigMap, or Role access;
|
|
241
|
+
- block dispatch when missing permissions cannot be safely approved;
|
|
242
|
+
- never expose Secret values in UI, logs, events, or prompt previews.
|
|
243
|
+
|
|
244
|
+
### Agent Mux gateway adapter
|
|
245
|
+
|
|
246
|
+
Internal module, not a user-facing controller by itself.
|
|
247
|
+
|
|
248
|
+
Responsibilities:
|
|
249
|
+
|
|
250
|
+
- query adapter capabilities/config schemas;
|
|
251
|
+
- launch sessions/runs;
|
|
252
|
+
- stream transcript/events;
|
|
253
|
+
- submit continuation, cancel, resume, fork, and approval input when supported;
|
|
254
|
+
- normalize Agent Mux runtime state into Krate `AgentSession`, `AgentDispatchAttempt`, and event projections.
|
|
255
|
+
|
|
256
|
+
## UI state rules
|
|
257
|
+
|
|
258
|
+
- Do not store launch-critical settings only in client state.
|
|
259
|
+
- Forms edit resource drafts and submit them through the same API path as YAML apply.
|
|
260
|
+
- Disabled actions must come from API authorization or policy status, not local UI-only role checks.
|
|
261
|
+
- Every mutating action must show the target resource, resulting YAML/action, and policy impact.
|
|
262
|
+
- Every long-running view must use Watch/SSE updates rather than polling-only UX.
|
|
263
|
+
- Every dispatch run must keep source-object breadcrumbs: repository, PR/issue/check/job/webhook/rule, workspace, session, runtime ServiceAccount, runner ServiceAccount, and artifacts.
|
|
264
|
+
- Secret/config grants and native RBAC status must drive stack warnings and disabled actions.
|
|
265
|
+
- A tool, skill, MCP server, or model provider that requires a Secret/ConfigMap must show a blocking warning when the selected agent identity lacks access.
|
|
266
|
+
|
|
267
|
+
## Screen-to-resource contracts
|
|
268
|
+
|
|
269
|
+
### Stack builder screen
|
|
270
|
+
|
|
271
|
+
Reads:
|
|
272
|
+
|
|
273
|
+
- `AgentStack`, `AgentSubagent`, `AgentToolProfile`, `AgentMcpServer`, `AgentSkill`, `AgentServiceAccount`, `AgentRoleBinding`, `AgentSecretGrant`, `AgentConfigGrant`, `AgentCapabilityRequirement`, adapter capabilities.
|
|
274
|
+
|
|
275
|
+
Writes:
|
|
276
|
+
|
|
277
|
+
- stack and referenced config resources.
|
|
278
|
+
|
|
279
|
+
Required UI states:
|
|
280
|
+
|
|
281
|
+
- invalid adapter capability;
|
|
282
|
+
- missing MCP health;
|
|
283
|
+
- missing ServiceAccount or runner identity;
|
|
284
|
+
- missing RoleBinding, Secret grant, or ConfigMap grant;
|
|
285
|
+
- permission review denied with least-privilege suggested fix;
|
|
286
|
+
- tool/skill/MCP/model requires secret or config the selected identity cannot access;
|
|
287
|
+
- unsupported subagent dispatch;
|
|
288
|
+
- unsafe approval mode for repo policy;
|
|
289
|
+
- dirty draft vs applied resource;
|
|
290
|
+
- YAML preview.
|
|
291
|
+
|
|
292
|
+
### Trigger builder screen
|
|
293
|
+
|
|
294
|
+
Reads:
|
|
295
|
+
|
|
296
|
+
- `AgentTriggerRule`, source event schemas, recent deliveries, stack list, context labels.
|
|
297
|
+
|
|
298
|
+
Writes:
|
|
299
|
+
|
|
300
|
+
- rule lifecycle changes and dry-run requests.
|
|
301
|
+
|
|
302
|
+
Required UI states:
|
|
303
|
+
|
|
304
|
+
- draft/active/paused/disabled/archived;
|
|
305
|
+
- sample event matched/not matched;
|
|
306
|
+
- dedupe key preview;
|
|
307
|
+
- expected context bundle preview;
|
|
308
|
+
- approval/write-back policy preview.
|
|
309
|
+
|
|
310
|
+
### Dispatch run screen
|
|
311
|
+
|
|
312
|
+
Reads:
|
|
313
|
+
|
|
314
|
+
- `AgentDispatchRun`, attempts, Agent Mux session, context bundle, approvals, artifacts, workspace, source refs.
|
|
315
|
+
|
|
316
|
+
Writes:
|
|
317
|
+
|
|
318
|
+
- cancel, retry, resume, fork, continue, approve/reject, write-back request.
|
|
319
|
+
|
|
320
|
+
Required UI states:
|
|
321
|
+
|
|
322
|
+
- queued/running/waiting/failed/succeeded/cancelled;
|
|
323
|
+
- transcript connected/disconnected/reconnecting;
|
|
324
|
+
- approval blocked;
|
|
325
|
+
- workspace missing/stale/rebase-needed;
|
|
326
|
+
- subagent running/failed/completed;
|
|
327
|
+
- artifact ready/pending/approved/applied.
|
|
328
|
+
|
|
329
|
+
### Workspace screen
|
|
330
|
+
|
|
331
|
+
Reads:
|
|
332
|
+
|
|
333
|
+
- `AgentWorkspace`, work item links, sessions, runs, git/runtime state, review artifacts.
|
|
334
|
+
|
|
335
|
+
Writes:
|
|
336
|
+
|
|
337
|
+
- lifecycle action requests and notes.
|
|
338
|
+
|
|
339
|
+
Required UI states:
|
|
340
|
+
|
|
341
|
+
- active/idle/archived/missing;
|
|
342
|
+
- dirty/clean/ahead/behind/rebase-conflict;
|
|
343
|
+
- dev server ready/unavailable;
|
|
344
|
+
- terminal command running/failed;
|
|
345
|
+
- linked issue/session/run absent or stale.
|
|
346
|
+
|
|
347
|
+
## API surface sketch
|
|
348
|
+
|
|
349
|
+
Future routes should mirror resources and actions:
|
|
350
|
+
|
|
351
|
+
- `GET /api/agents/stacks`
|
|
352
|
+
- `POST /api/agents/stacks`
|
|
353
|
+
- `GET /api/agents/capabilities`
|
|
354
|
+
- `GET /api/agents/identities`
|
|
355
|
+
- `POST /api/agents/identities/service-accounts`
|
|
356
|
+
- `GET /api/agents/permissions`
|
|
357
|
+
- `POST /api/agents/permissions/role-bindings`
|
|
358
|
+
- `POST /api/agents/permissions/review`
|
|
359
|
+
- `GET /api/agents/secrets`
|
|
360
|
+
- `POST /api/agents/secrets/grants`
|
|
361
|
+
- `POST /api/agents/config/grants`
|
|
362
|
+
- `GET /api/agents/runs`
|
|
363
|
+
- `POST /api/agents/runs`
|
|
364
|
+
- `GET /api/agents/runs/:run/events`
|
|
365
|
+
- `POST /api/agents/runs/:run/cancel`
|
|
366
|
+
- `POST /api/agents/runs/:run/continue`
|
|
367
|
+
- `POST /api/agents/runs/:run/retry`
|
|
368
|
+
- `GET /api/agents/rules`
|
|
369
|
+
- `POST /api/agents/rules/:rule/dry-run`
|
|
370
|
+
- `POST /api/agents/approvals/:approval/decision`
|
|
371
|
+
- `GET /api/agents/workspaces`
|
|
372
|
+
- `POST /api/agents/workspaces/:workspace/action`
|
|
373
|
+
- `GET /api/watch/orgs/[org]/agentdispatchruns`
|
|
374
|
+
- `GET /api/watch/orgs/[org]/agentapprovals`
|
|
375
|
+
|
|
376
|
+
These can later map to Kubernetes-style resource paths or aggregated API endpoints; the UI should not depend on in-memory-only route state.
|
|
377
|
+
|
|
378
|
+
## Acceptance criteria
|
|
379
|
+
|
|
380
|
+
- Every agent UI surface documents which resource(s) it reads, writes, and watches.
|
|
381
|
+
- Stack settings affect launch behavior only through persisted stack/tool/MCP/skill/subagent resources.
|
|
382
|
+
- Trigger settings affect dispatch only through `AgentTriggerRule` and recorded trigger executions.
|
|
383
|
+
- Dispatches appear beside pipeline runs and can open linked Agent Mux chat/session.
|
|
384
|
+
- Workspace/session links are visible from issue, PR, pipeline, run, workspace, and session pages.
|
|
385
|
+
- Privileged agent actions require `AgentApproval` or explicit repository policy.
|
|
386
|
+
- Native Kubernetes RBAC remains authoritative for users, agents, and runners; Krate syncs and projects it instead of replacing it.
|
|
387
|
+
- Secret and ConfigMap access is granted by explicit resources and surfaced in stack/tool/skill/MCP readiness.
|
|
388
|
+
- Controllers and APIs can be implemented from the spec without inventing hidden UI-only state.
|
|
389
|
+
|
|
390
|
+
## Company brain memory UX
|
|
391
|
+
|
|
392
|
+
Krate should expose company brain memory as a system capability, not a hidden retrieval feature.
|
|
393
|
+
|
|
394
|
+
| Surface | Required UX |
|
|
395
|
+
| --- | --- |
|
|
396
|
+
| `/agents/memory` | memory repo health, current commit, ontology status, index freshness, pending updates, stale records, and denied queries. |
|
|
397
|
+
| `/agents/memory/graph` | graph browser with node kind filters, edge traversal, owners, repository associations, and source files. |
|
|
398
|
+
| `/agents/memory/search` | grep-like Markdown search with path/kind scopes and permission-aware redaction. |
|
|
399
|
+
| `/agents/memory/updates` | proposed memory patches, validation report, source run, reviewers, PR link, approval, merge, reject. |
|
|
400
|
+
| dispatch composer | memory source picker, current/ref/tag/refAt control, query preview, selected graph records, selected grep excerpts, stale-memory warning. |
|
|
401
|
+
| run detail | memory snapshot commit, query manifest, selected memory, diff against current, update proposal actions. |
|
|
402
|
+
| repository settings | associate repo with memory paths, graph kinds, owners, and default query mode. |
|
|
403
|
+
|
|
404
|
+
Advanced controls such as `run with memory from two days ago` belong behind an expandable memory settings panel but should still resolve to an explicit timestamp and commit before dispatch.
|
|
405
|
+
|
|
406
|
+
## Org-scoped navigation
|
|
407
|
+
|
|
408
|
+
The app should behave like a GitHub organization-first product:
|
|
409
|
+
|
|
410
|
+
- global switcher selects the active org;
|
|
411
|
+
- repository, agent, deployment, memory, runner, secret, and settings pages live under `/orgs/[org]`;
|
|
412
|
+
- non-org repository routes are not product surface;
|
|
413
|
+
- breadcrumbs always show org, repository/deployment, and current resource;
|
|
414
|
+
- cross-org search results are grouped by org and require explicit permission;
|
|
415
|
+
- `/orgs/[org]/agents/memory` exposes `MEMORY.md`, sessions, run journals, retrospectives, and imports from that org only.
|
|
416
|
+
|
|
417
|
+
## Current UI seam alignment
|
|
418
|
+
|
|
419
|
+
The existing Krate UI already provides org navigation, repository tabs, deployment pages, run pages, and advanced resource panels. The agent experience should preserve that GitHub-like structure:
|
|
420
|
+
|
|
421
|
+
- add `Agents` to the org sidebar/topbar, not a separate standalone product shell;
|
|
422
|
+
- render agent runs beside repository runs and link to full run detail;
|
|
423
|
+
- expose company brain memory under the org's agent section;
|
|
424
|
+
- use repository settings for repo-specific memory sources, triggers, and grants;
|
|
425
|
+
- keep YAML/resource plans in expandable advanced panels consistent with current UI patterns;
|
|
426
|
+
- keep chat/session as a panel inside the run detail, not as the primary navigation object.
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Agent workspace lifecycle spec
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Agent workspaces connect repository state, issue/PR work, Agent Mux sessions, runtime previews, and write-back artifacts. This document defines workspace lifecycle and associations in Krate while preserving repository-native navigation.
|
|
6
|
+
|
|
7
|
+
## Workspace resource model
|
|
8
|
+
|
|
9
|
+
`AgentWorkspace` represents a git worktree or workspace projection.
|
|
10
|
+
|
|
11
|
+
Important fields:
|
|
12
|
+
|
|
13
|
+
- repository;
|
|
14
|
+
- workspace path or external workspace ID;
|
|
15
|
+
- branch/ref/SHA;
|
|
16
|
+
- ownership: host, project, issue, PR, dispatch run;
|
|
17
|
+
- trust tier;
|
|
18
|
+
- runtime ServiceAccount;
|
|
19
|
+
- runner pool;
|
|
20
|
+
- active sessions;
|
|
21
|
+
- active dispatch runs;
|
|
22
|
+
- git status;
|
|
23
|
+
- runtime surfaces;
|
|
24
|
+
- lifecycle state;
|
|
25
|
+
- retention/cleanup policy.
|
|
26
|
+
|
|
27
|
+
## Workspace ownership
|
|
28
|
+
|
|
29
|
+
Ownership sources:
|
|
30
|
+
|
|
31
|
+
- repository host workspace;
|
|
32
|
+
- issue-created workspace;
|
|
33
|
+
- PR repair workspace;
|
|
34
|
+
- pipeline failure workspace;
|
|
35
|
+
- manual dispatch workspace;
|
|
36
|
+
- project/board workspace.
|
|
37
|
+
|
|
38
|
+
Ownership must be visible from both workspace page and source object page.
|
|
39
|
+
|
|
40
|
+
## Associations
|
|
41
|
+
|
|
42
|
+
| Link | Meaning |
|
|
43
|
+
| --- | --- |
|
|
44
|
+
| `WorkItemWorkspaceLink` | issue/work item owns or references workspace |
|
|
45
|
+
| `WorkItemSessionLink` | issue/work item has active agent chat/session |
|
|
46
|
+
| `AgentDispatchRun.spec.workspaceRef` | run used a workspace |
|
|
47
|
+
| `AgentSession.status.workspaceRef` | chat/session attached to workspace |
|
|
48
|
+
| `AgentArtifact.spec.workspaceRef` | artifact was produced from workspace state |
|
|
49
|
+
|
|
50
|
+
## Lifecycle actions
|
|
51
|
+
|
|
52
|
+
Actions:
|
|
53
|
+
|
|
54
|
+
- provision;
|
|
55
|
+
- link existing;
|
|
56
|
+
- pin;
|
|
57
|
+
- unpin;
|
|
58
|
+
- archive;
|
|
59
|
+
- cleanup;
|
|
60
|
+
- recover;
|
|
61
|
+
- notes-save;
|
|
62
|
+
- rebase-start;
|
|
63
|
+
- rebase-auto-resolve;
|
|
64
|
+
- rebase-open-in-editor;
|
|
65
|
+
- rebase-mark-resolved;
|
|
66
|
+
- rebase-abort.
|
|
67
|
+
|
|
68
|
+
Each action should be an API action that writes a resource/action record and is audited.
|
|
69
|
+
|
|
70
|
+
## Git state
|
|
71
|
+
|
|
72
|
+
Workspace status should include:
|
|
73
|
+
|
|
74
|
+
- branch;
|
|
75
|
+
- head SHA;
|
|
76
|
+
- tracking branch;
|
|
77
|
+
- ahead/behind;
|
|
78
|
+
- dirty state;
|
|
79
|
+
- uncommitted count;
|
|
80
|
+
- conflicting files;
|
|
81
|
+
- rebase status;
|
|
82
|
+
- last activity time;
|
|
83
|
+
- missing path state;
|
|
84
|
+
- editor link where safe.
|
|
85
|
+
|
|
86
|
+
## Runtime surfaces
|
|
87
|
+
|
|
88
|
+
Runtime surfaces may include:
|
|
89
|
+
|
|
90
|
+
- preview URL;
|
|
91
|
+
- dev server URL;
|
|
92
|
+
- terminal/session status;
|
|
93
|
+
- logs;
|
|
94
|
+
- health probe;
|
|
95
|
+
- port forwards;
|
|
96
|
+
- MCP/runtime state.
|
|
97
|
+
|
|
98
|
+
These are metadata and links; sensitive tokens must not be exposed.
|
|
99
|
+
|
|
100
|
+
## Trust and isolation
|
|
101
|
+
|
|
102
|
+
- Untrusted/forked refs require isolated workspace and unprivileged ServiceAccount.
|
|
103
|
+
- Trusted branch workspaces may use broader caches/secrets only through policy.
|
|
104
|
+
- Workspace reuse must check repository/ref/trust compatibility.
|
|
105
|
+
- Cleanup must not delete user-managed paths outside the workspace root.
|
|
106
|
+
- Missing workspace path should not delete records automatically; user can recover/archive/cleanup.
|
|
107
|
+
|
|
108
|
+
## UI surfaces
|
|
109
|
+
|
|
110
|
+
### Repository Code
|
|
111
|
+
|
|
112
|
+
- show active workspace for branch/path;
|
|
113
|
+
- create workspace for dispatch;
|
|
114
|
+
- open session/runtime links.
|
|
115
|
+
|
|
116
|
+
### Issues and PRs
|
|
117
|
+
|
|
118
|
+
- show linked workspace/session/run/artifacts;
|
|
119
|
+
- create workspace from issue/PR;
|
|
120
|
+
- show rebase/conflict state before write-back.
|
|
121
|
+
|
|
122
|
+
### Run detail
|
|
123
|
+
|
|
124
|
+
- show workspace card with git/runtime state;
|
|
125
|
+
- link artifacts to workspace diff;
|
|
126
|
+
- show workspace missing/rebase states.
|
|
127
|
+
|
|
128
|
+
### Global workspaces
|
|
129
|
+
|
|
130
|
+
- inventory by repository, status, owner, last activity, trust tier;
|
|
131
|
+
- attention mode for missing, dirty, conflicted, approval-blocked, archived.
|
|
132
|
+
|
|
133
|
+
## Controller behavior
|
|
134
|
+
|
|
135
|
+
Future file:
|
|
136
|
+
|
|
137
|
+
- `src/agent-workspace-controller.js`
|
|
138
|
+
|
|
139
|
+
Responsibilities:
|
|
140
|
+
|
|
141
|
+
- provision/link workspaces;
|
|
142
|
+
- validate workspace policy and trust tier;
|
|
143
|
+
- inventory git/runtime status;
|
|
144
|
+
- handle lifecycle actions;
|
|
145
|
+
- maintain association links;
|
|
146
|
+
- publish watch events for UI;
|
|
147
|
+
- prevent unsafe cleanup/deletion.
|
|
148
|
+
|
|
149
|
+
## Failure modes
|
|
150
|
+
|
|
151
|
+
| Failure | Behavior |
|
|
152
|
+
| --- | --- |
|
|
153
|
+
| path missing | mark missing and offer recover/archive/cleanup |
|
|
154
|
+
| dirty workspace | block unsafe cleanup and write-back until reviewed |
|
|
155
|
+
| rebase conflict | show conflict files and rebase actions |
|
|
156
|
+
| runtime unavailable | keep workspace usable and show runtime degraded |
|
|
157
|
+
| workspace belongs to different trust tier | block reuse |
|
|
158
|
+
| cleanup outside root | deny and audit policy violation |
|
|
159
|
+
|
|
160
|
+
## Acceptance criteria
|
|
161
|
+
|
|
162
|
+
- Issue/PR/run/session/workspace associations are visible from every related page.
|
|
163
|
+
- Workspace lifecycle actions are policy-checked and audited.
|
|
164
|
+
- Missing/rebase/dirty states block unsafe write-back with clear UI reasons.
|
|
165
|
+
- Untrusted work never reuses trusted workspaces.
|
|
166
|
+
- Workspace records survive controller restarts and can recover from missing paths.
|