Skip to content

Conversation

alexvy86
Copy link
Owner

Description

Follow up to microsoft#15532. Same change, more packages.

PR within my fork for now to hide the changes from 15532.

Reviewer Guidance

Diffs all look reasonable:

fluidframework-container-definitions
fluidframework-core-interfaces
fluidframework-core-utils
fluidframework-driver-definitions
fluidframework-fluid-runner
fluidframework-odsp-doclib-utils
fluidframework-telemetry-utils
fluidframework-tool-utils
fluid-internal-replay-tool
fluid-tools-fetch-tool
fluid-tools-webpack-fluid-loader

@alexvy86 alexvy86 changed the title Move to package.json files for packages/{common,tools,utils} chore: Stop including unnecessary files in published packages (packages/{common,tools,utils}) May 10, 2023
alexvy86 pushed a commit that referenced this pull request May 9, 2025
…pes into a consumable version for UI visualizations (microsoft#24482)

## Description
Currently, the only way to get a set of objects for visualizing each
change an LLM makes to your tree using the aiCollab library is for users
to use the `sharedTreeDiff` utility that was created for the implicit
strategy separately. This utility is not perfect, likely does not cover
many edge cases and is fickle. However, when using the explicit strategy
we maintain an edit log internally that is the source truth. Currently,
we don't return the editLog because the `TreeEdit` type of the edit log
is not simple for users the consume and visualize changes on their UI.

The purpose of this ticket is to update the explicit strategy's entry
point function `generateTreeEdits` by taking the editLog, which is an
array of `TreeEdit`, and transforming it into a new set of objects
"diffs" that can be easily used for UI visualizations and return it
along with the success/fail response.

## Test
Mapping the edit log diff to the front-end task card diff objects:
~~~
Front-end Diff: Insert
[
    {
        "type": "INSERT",
        "path": [
            "tasks",
            3
        ],
        "value": {
            "title": "Task #4",
            "id": "2756a2e9-237d-487e-b75a-4ab7dd5e4a0d",
            "description": "This is the fourth task.",
            "priority": "Medium",
            "complexity": 2,
            "status": "To Do",
            "assignee": "Bob"
        }
    }
]
~~~
~~~
Edit Log: Insert
[
    {
        "edit": {
            "type": "insert",
"explanation": "Insert a new task titled 'Task #4' with description
'This is the fourth task.', priority 'Medium', complexity 2, and status
'To Do'. Assign the task to Bob and add it to the end of the tasks
array.",
            "content": {
                "__fluid_objectId": "Task4",
                "title": "Task #4",
                "id": "2756a2e9-237d-487e-b75a-4ab7dd5e4a0d",
                "description": "This is the fourth task.",
                "priority": "Medium",
                "complexity": 2,
                "status": "To Do",
                "assignee": "Bob"
            },
            "destination": {
                "type": "arrayPlace",
                "parentId": "TaskGroup1",
                "field": "tasks",
                "location": "end"
            }
        }
    }
]
~~~

~~~
Front-end Diff: Change
[
    {
        "path": [
            "tasks",
            0,
            "status"
        ],
        "type": "CHANGE",
        "value": "Done",
        "oldValue": "To Do",
        "objectId": "09138b2d-a75e-4376-be83-2be153c18ba6"
    }
]
~~~
~~~
Edit log: Change
[
    {
        "edit": {
            "type": "modify",
"explanation": "Change the status of Task #1 from 'To Do' to 'Done'",
            "target": {
                "target": "Task1"
            },
            "field": "status",
            "modification": "Done"
        }
    }
]
~~~

~~~
Front-end Diff: Remove
[
    {
        "type": "REMOVE",
        "path": [
            "tasks",
            0
        ],
        "oldValue": {
            "title": "Task #1",
            "id": "09138b2d-a75e-4376-be83-2be153c18ba6",
"description": "This is the first task. Blah Blah blah Blah Blah
blahBlah Blah blahBlah Blah blahBlah Blah blah",
            "priority": "Low",
            "complexity": 1,
            "status": "To Do",
            "assignee": "Alice"
        },
        "objectId": "09138b2d-a75e-4376-be83-2be153c18ba6"
    },
    {
        "type": "MOVE",
        "path": [
            "tasks",
            1
        ],
        "newIndex": 0,
        "value": {
            "title": "Task #2",
            "id": "09138b2d-a75e-4376-be83-2be153c18ba7",
"description": "This is the second task. Blah Blah blah Blah Blah
blahBlah Blah blahBlah Blah blahBlah Blah blah",
            "priority": "Medium",
            "complexity": 2,
            "status": "In Progress",
            "assignee": "Bob"
        },
        "objectId": "09138b2d-a75e-4376-be83-2be153c18ba7"
    },
    {
        "type": "MOVE",
        "path": [
            "tasks",
            2
        ],
        "newIndex": 1,
        "value": {
            "title": "Task #3",
            "id": "09138b2d-a75e-4376-be83-2be153c18ba8",
"description": "This is the third task! Blah Blah blah Blah Blah
blahBlah Blah blahBlah Blah blahBlah Blah blah",
            "priority": "High",
            "complexity": 3,
            "status": "Done",
            "assignee": "Charlie"
        },
        "objectId": "09138b2d-a75e-4376-be83-2be153c18ba8"
    },
    {
        "type": "MOVE",
        "path": [
            "tasks",
            3
        ],
        "newIndex": 2,
        "value": {
            "title": "Task #4",
            "id": "2756a2e9-237d-487e-b75a-4ab7dd5e4a0d",
            "description": "This is the fourth task.",
            "priority": "Medium",
            "complexity": 2,
            "status": "To Do",
            "assignee": "Bob"
        },
        "objectId": "2756a2e9-237d-487e-b75a-4ab7dd5e4a0d"
    }
]
~~~
~~~
Edit log: Remove
{
    "type": "remove",
    "explanation": "Remove Task#1 from the tasks array.",
    "source": {
        "target": "Task1"
    }
}
~~~

~~~
Front-end Diff: Move
[
    {
        "type": "MOVE",
        "path": [
            "tasks",
            0
        ],
        "newIndex": 3,
        "value": {
            "title": "Task #1",
            "id": "09138b2d-a75e-4376-be83-2be153c18ba6",
"description": "This is the first task. Blah Blah blah Blah Blah
blahBlah Blah blahBlah Blah blahBlah Blah blah",
            "priority": "Low",
            "complexity": 1,
            "status": "To Do",
            "assignee": "Alice"
        },
        "objectId": "09138b2d-a75e-4376-be83-2be153c18ba6"
    },
    {
        "type": "MOVE",
        "path": [
            "tasks",
            1
        ],
        "newIndex": 0,
        "value": {
            "title": "Task #2",
            "id": "09138b2d-a75e-4376-be83-2be153c18ba7",
"description": "This is the second task. Blah Blah blah Blah Blah
blahBlah Blah blahBlah Blah blahBlah Blah blah",
            "priority": "Medium",
            "complexity": 2,
            "status": "In Progress",
            "assignee": "Bob"
        },
        "objectId": "09138b2d-a75e-4376-be83-2be153c18ba7"
    },
    {
        "type": "MOVE",
        "path": [
            "tasks",
            2
        ],
        "newIndex": 1,
        "value": {
            "title": "Task #3",
            "id": "09138b2d-a75e-4376-be83-2be153c18ba8",
"description": "This is the third task! Blah Blah blah Blah Blah
blahBlah Blah blahBlah Blah blahBlah Blah blah",
            "priority": "High",
            "complexity": 3,
            "status": "Done",
            "assignee": "Charlie"
        },
        "objectId": "09138b2d-a75e-4376-be83-2be153c18ba8"
    },
    {
        "type": "MOVE",
        "path": [
            "tasks",
            3
        ],
        "newIndex": 2,
        "value": {
            "title": "Task #4",
            "id": "2756a2e9-237d-487e-b75a-4ab7dd5e4a0d",
            "description": "This is the fourth task.",
            "priority": "Medium",
            "complexity": 2,
            "status": "To Do",
            "assignee": "Bob"
        },
        "objectId": "2756a2e9-237d-487e-b75a-4ab7dd5e4a0d"
    }
]
~~~
~~~
Edit log: Move
[
    {
        "edit": {
            "type": "move",
"explanation": "Move Task #1 to the end of the tasks array.",
            "source": {
                "target": "Task1"
            },
            "destination": {
                "type": "arrayPlace",
                "parentId": "TaskGroup1",
                "field": "tasks",
                "location": "end"
            }
        }
    }
]
~~~


AB#[21569](https://dev.azure.com/fluidframework/internal/_workitems/edit/21569)

---------

Co-authored-by: Joshua Smithrud <[email protected]>
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