Skip to content

feat(ai-workspace): surface AI files in FxFiles + move-as-access-control (1.i/1.ii/1.iii)#93

Merged
ehsan6sha merged 1 commit into
mainfrom
feat/ai-workspace-surfacing
Jun 25, 2026
Merged

feat(ai-workspace): surface AI files in FxFiles + move-as-access-control (1.i/1.ii/1.iii)#93
ehsan6sha merged 1 commit into
mainfrom
feat/ai-workspace-surfacing

Conversation

@ehsan6sha

Copy link
Copy Markdown
Member

What

Surface the AI/MCP's fula-ai-workspace files in FxFiles and let the user move files in/out of it to grant/revoke AI access (issue #1: 1.i / 1.ii / 1.iii). Depends on the Worker writing files forest-indexed (functionland/pinning-service#68, functionland/fula-api#82).

P1 — category map (1.i)

The MCP writes singular category segments (ai/document/, ai/note/, ai/image/ …) but FxFiles' category views are plural. _mergeAiWorkspaceInto now maps them and folds the AI categories with no FileCategory home into the closest view: images ← image + screenshot, documents ← document + note + link, other ← file + other. A view with no AI mapping (downloads/archives/starred) short-circuits (no workspace list call).

P2 — cloud-files bucket view (1.i)

_loadObjects routes fula-ai-workspace through the workspace client (workspace secret) instead of the master-KEK listObjects, so the files decrypt + list, tagged sourceBucket for correct open/move routing.

P3 — move-as-access-control (1.ii / 1.iii)

  • Move IN → re-encrypt under the workspace secret + forest-index under ai/<category>/<name> (grant AI read).
  • Move OUT → re-encrypt under the master KEK in a normal bucket + remove the workspace copy (revoke), with a verified revoke: the master-KEK copy must decrypt before the AI copy is deleted, then the AI copy is verified gone — revoke incomplete is surfaced loudly otherwise.
  • All re-keying is client-side (the master KEK never leaves FxFiles). New primitives: uploadWorkspaceObject (putFlat), deleteWorkspaceObject (deleteFlat — removes the forest index entry, not just the blob).
  • The orchestration is a UI-free aiAwareMove() so the security-critical revoke is unit-tested.

Test

flutter analyze clean (whole project, 0 errors). 25 AI unit tests pass, including: singular→plural mapping + homeless folding; grant; verified revoke; abort-without-delete when the re-encrypted copy fails to verify; normal move.

Note on ordering

Additive + safe to land before the Worker deploy: until the Worker writes indexed files, the workspace reads empty (shows nothing extra); a move stores correctly via FxFiles' own forest-tracked put, and AI read activates once the Worker is live.

🤖 Generated with Claude Code

…rol (1.i/1.ii/1.iii)

After the Worker writes AI files forest-indexed (functionland/pinning-service#68 +
functionland/fula-api#82), FxFiles can see + move them. Three parts:

P1 (1.i) category map: the MCP writes SINGULAR category segments (ai/document/,
ai/note/, ai/image/ …); FxFiles' category views are PLURAL. _mergeAiWorkspaceInto now
maps them (images<-image+screenshot, documents<-document+note+link, other<-file+other)
and folds the AI categories with no FileCategory of their own into the closest view. A
view with no AI mapping (downloads/archives/starred) short-circuits.

P2 (1.i) cloud-files: the bucket view routes fula-ai-workspace through the workspace
client (workspace secret) instead of the master-KEK listObjects, so the AI files
decrypt + list, tagged sourceBucket for correct open/move routing.

P3 (1.ii/1.iii) move-as-access-control: moving a file INTO the AI bucket re-encrypts it
under the workspace secret + forest-indexes it (grant AI read) under an
ai/<category>/<name> key; moving OUT re-encrypts under the master KEK and removes the
workspace copy (revoke). The revoke is VERIFIED: the re-encrypted master copy must
decrypt BEFORE the AI copy is deleted, then the AI copy is verified gone — "revoke
incomplete" is surfaced loudly otherwise. All re-keying is client-side (the KEK never
leaves FxFiles). New primitives: uploadWorkspaceObject (putFlat), deleteWorkspaceObject
(deleteFlat, which removes the forest entry too).

The move orchestration is factored into a UI-free aiAwareMove() so the security-
critical revoke is unit-tested (grant / verified-revoke / abort-without-delete-on-
failed-verify / normal-move). flutter analyze clean (0 errors); 25 AI unit tests green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0161UGEJmTpM6DM2cVZyV6Ev
@ehsan6sha ehsan6sha merged commit a711280 into main Jun 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant