feat: implement RecordActivity function and update CallerIdentity struct#1
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a WASM-only activity recording pathway (via a new paca.activity_record host import) and extends request caller identity to include an authenticated user UUID intended to be used as the activity actor.
Changes:
- Added
hostActivityRecordWASM import and a newRecordActivityhelper to serialize and emit task-activity records from WASM. - Added a native (non-WASM) no-op stub for
RecordActivityto keep builds compatible. - Extended
CallerIdentitywithUserIDfor representing the authenticated user UUID.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| wasm_imports.go | Declares the new paca.activity_record host import for WASM builds. |
| wasm_backends.go | Implements RecordActivity and defines the JSON payload shape sent to the host. |
| native_backends.go | Adds a non-WASM no-op RecordActivity stub. |
| request.go | Extends CallerIdentity with UserID to carry authenticated user UUID. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Paca-AI/plugin-sdk-go/sessions/244e47a5-a8a9-4aff-bedf-a6e4d5fcab1b Co-authored-by: pikann <41873019+pikann@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new mechanism for recording task-related activities in WASM builds, ensuring that activity events can be persisted and later processed. It also adds support for tracking the authenticated user's UUID in request contexts. The most important changes are:
Activity Recording Infrastructure:
RecordActivityfunction inwasm_backends.goto emit task-activity events, which are serialized and sent to thepaca.activity_recordhost function for persistence. This function requires task, project, actor, and activity type information, along with JSON-encodable content.hostActivityRecordWASM import inwasm_imports.goto allow WASM modules to call the host for recording activities.RecordActivityinnative_backends.goto ensure compatibility in non-WASM builds.Request Context Enhancement:
CallerIdentitystruct inrequest.goto include aUserIDfield, representing the authenticated user's UUID, which should be used as the actor ID when recording activities.