Skip to content

feat: add workspace state and plugin communication#1

Open
DongyuZhao wants to merge 2 commits into
mainfrom
codex/design-core-architecture-and-state-management
Open

feat: add workspace state and plugin communication#1
DongyuZhao wants to merge 2 commits into
mainfrom
codex/design-core-architecture-and-state-management

Conversation

@DongyuZhao

Copy link
Copy Markdown
Owner

Summary

  • introduce CodeCanvasStore and CodeCanvasWorkspace for managing canvas state
  • connect bench and canvas via environment objects to allow plugins to open workspaces
  • extend example benches with simple file and trace interactions

Testing

  • swift test

https://chatgpt.com/codex/tasks/task_e_6897069f9a78832290ca438b4a6c7883

Copilot AI review requested due to automatic review settings August 9, 2025 08:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds workspace state management and plugin communication to the CodeCanvas framework. It introduces a centralized store for managing canvas workspaces and enables bench components to open workspaces through environment objects.

  • Adds CodeCanvasStore and CodeCanvasWorkspace protocol for managing workspace state
  • Connects bench components to canvas via environment objects for plugin communication
  • Updates example benches with interactive file and trace functionality

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
CodeEditorExtension.swift Adds file editor workspace and interactive file collection with store integration
ClientRestfulExtension.swift Adds REST client workspace and interactive trace collection with store integration
CodeSpaceContainer.swift Updates to display workspace content from store when available
CodeBenchContainer.swift Adds store environment object and clears workspace on bench selection
CodeCanvasShell.swift Creates and provides store as environment object to child views
CodeCanvasStore.swift New store class for managing workspace state with open/clear methods
CodeCanvasWorkspace.swift New protocol defining workspace interface with content view method
CodeCanvasFile.swift Makes file model conform to Identifiable protocol
CodeCanvasExtension.swift Adds SwiftUI import guard for consistency

import SwiftUI

public final class CodeCanvasStore: ObservableObject {
@Published public var workspace: (any CodeCanvasWorkspace)?

Copilot AI Aug 9, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workspace property should be private(set) to prevent external modification and maintain encapsulation. External code should only be able to modify the workspace through the open() and clear() methods.

Suggested change
@Published public var workspace: (any CodeCanvasWorkspace)?
@Published public private(set) var workspace: (any CodeCanvasWorkspace)?

Copilot uses AI. Check for mistakes.
@DongyuZhao DongyuZhao force-pushed the main branch 2 times, most recently from 4680036 to 112b8c2 Compare August 9, 2025 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants