-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save command-result card to workspace #1647
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I sometimes see results not appearing. I thought this was actually fixed before.. is it your experience to see this often? |
So we copy the result card to the workspace but not the cards itself. The result card will just linksToMany back to wherever the cards come from? |
Are you talking about CS-7255? I only saw that happen on prod. I haven't checked recently on prod. |
Yes, the idea is that any card shared in chat can be copied to workspace the same way. In the isolated search results card, the results are clickable. |
packages/base/command.gts
Outdated
@field toolCallId = contains(StringField); | ||
@field name = contains(StringField); | ||
@field payload = contains(CommandObjectField); //arguments of toolCall. Its not called arguments due to lint | ||
@field payload = contains(ToolCallArg); //arguments of toolCall. Its not called arguments due to lint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we prefer this to be more abstract than "ToolCallArg". That phrase is AI Bot specific as far as I understand it, and not all commands should interact with AI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is CommandObjectField
a better name then? I also considered converting it to a string and parsing as needed.
// @ts-ignore "cardContext is declared but not used" | ||
private get cardContext() { | ||
return { | ||
actions: this.publicAPI(this, this.stacks[0]?.length ? 1 : 0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that targeting the right column is the correct default for the copy command, but is it really the correct default for all actions?
if (opts?.isWritableRealm) { | ||
let url = card?.[api.realmURL]; | ||
if (url && this.realm.canWrite(url.href)) { | ||
return url; | ||
} | ||
if (!this.realm.defaultWritableRealm) { | ||
throw new Error('Could not find a writable realm'); | ||
} | ||
return new URL(this.realm.defaultWritableRealm.path); | ||
} | ||
// in the case where we get no realm URL from the card, we are dealing with | ||
// a new card instance that does not have a realm URL yet. | ||
return card[api.realmURL] ?? new URL(this.realm.defaultReadableRealm.path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that this PR is extending the existing fallback behavior. But this fallback behavior doesn't belong here.
getRealmURL
should only return a card's actual realm url. When there isn't one, it should return undefined, and it should be up to the caller to pick a default instead.
Opened the menu with the button again after copy for the screenshot:
![copy-to-workspace](https://private-user-images.githubusercontent.com/16160806/373672906-19f25b98-f06f-4a18-93b9-3ff49b306c54.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5MzIyNzUsIm5iZiI6MTczODkzMTk3NSwicGF0aCI6Ii8xNjE2MDgwNi8zNzM2NzI5MDYtMTlmMjViOTgtZjA2Zi00YTE4LTkzYjktM2ZmNDliMzA2YzU0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDEyMzkzNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJkYjlmY2U5MDkyNWJkYjMzNWUwNzU5MjJiMmZhODk5MDY1YTk5MjNkMzgxOGI2Y2QxOTA0OWM5YzI5ZTA5NjQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.MfPsm40-c1HLOyy__AXmSJHTeXR_DCrAK0iSTm_jV4M)
copyCard
action in interact submode (because the logic for checking the realm of any open card in stack required this to live there)@provide
pattern)isWritableRealm
) togetRealmURL
function incardService
for it to return a writable realm url. By default it returns a readable realm url.Copy to Workspace
, then we save a copy of the CommandResult card in user's workspace.Note: